User Tools

Site Tools


reference:lua_smtp_mx_control

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
reference:lua_smtp_mx_control [2016/12/16 10:08] – [Remote Server Settings] paulreference:lua_smtp_mx_control [2025/08/14 10:27] (current) paul
Line 1: Line 1:
 ======Lua SMTP MX Control====== ======Lua SMTP MX Control======
  
-Every time VPOP3 is going to send messages using direct MX sending, it runs a script called **mxout.lua** in the VPOP3 directory.+Every time VPOP3 is going to send messages using direct MX sending, it runs a script called **mxout.lua** which can be created/edited in Settings -> Scripts (or in the VPOP3 directory in VPOP3 v6.6 or earlier).
  
 =====Messages to be sent===== =====Messages to be sent=====
Line 30: Line 30:
 =====Remote Server Settings===== =====Remote Server Settings=====
 If you need to tweak how VPOP3 connects to remote servers you can write a **ServerDetails** function. VPOP3 calls this function before sending each message. If you need to tweak how VPOP3 connects to remote servers you can write a **ServerDetails** function. VPOP3 calls this function before sending each message.
 +
 +(This function was [[https://bugtracker.pscs.co.uk/view.php?id=968|added in VPOP3 v6.5]])
  
 The function signature is: The function signature is:
Line 64: Line 66:
 Example - don't use SSL when connecting to 'mail.broken.com' Example - don't use SSL when connecting to 'mail.broken.com'
  
-  function ServerDetails(params, headers actions) +  function ServerDetails(params, headersactions) 
-    if (params["server"] == "mail.broken.com"+    if params["server"] == "mail.broken.com" then
       actions["tryTLS"] = 0       actions["tryTLS"] = 0
     end     end
Line 72: Line 74:
      
  
 +=====ParseURL=====
 +(VPOP3 8.0 and later)
 +
 +=====Return Path Modification=====
 +
 +In VPOP3 v8.8 and later, a function is called as each message is sent, allowing the Lua script to rewrite the Return Path (MAIL FROM) address. This can be useful for implementing things such as SRS or other sender rewriting
 +
 +The function signature is: **ModifyReturnPath(Computed-Mail-From, Mail-From, Original-Mail-From, Auth-Sender, Recipients, Creation-Time, Headers, Size, Sender-IP-Address, Subject, All-Recipients)**
 +
 +  * Computed-Mail-From - the Return Path after being processed by VPOP3 (eg using 'Return Path Settings' in the Mail Sender). This is the Return Path that will be used if the Lua script doesn't give an alternative
 +  * Mail-From - the Return Path prior to the Return Path Settings acting on it. This can take account of Mappings to change it
 +  * Original-Mail-From - the original Return Path when the message was sent
 +  * Auth-Sender - the authenticated VPOP3 user who sent the message
 +  * Recipients - a table of recipients to whom this message will be sent at this time
 +  * Creation-Time - the time the outgoing message was created in VPOP3. In ISO-8601 format
 +  * Headers - a table of the message headers
 +  * Size - the message size
 +  * Sender-IP-Address - the IP address of the message sender (or blank if created by VPOP3)
 +  * Subject - the message subject
 +  * All-Recipients - a table of all the recipients the message was sent to. This may contain more recipients than the 'Recipients' table, because the message may already have been sent to some recipients, or Domain Filtering may have removed some recipients from this send attempt
 +
 +The function can return a single string value which is the new Return Path to use (if it doesn't return anything, then the 'Computed-Mail-From' value will be used).
reference/lua_smtp_mx_control.1481882935.txt.gz · Last modified: 2018/11/14 10:44 (external edit)