This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| reference:lua_smtp_mx_control [2017/08/25 08:24] – [Remote Server Settings] paul | reference:lua_smtp_mx_control [2026/02/24 15:49] (current) – [Lua SMTP MX Control] paul | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Every time VPOP3 is going to send messages using direct MX sending, it runs a script called **mxout.lua** which can be created/ | Every time VPOP3 is going to send messages using direct MX sending, it runs a script called **mxout.lua** which can be created/ | ||
| + | ====Global Variables==== | ||
| + | Starting with v8.8, the following global variables are defined: | ||
| + | |||
| + | * ConnectionId - the numeric Sender/ | ||
| + | * ConnectionName - the text Sender/ | ||
| =====Messages to be sent===== | =====Messages to be sent===== | ||
| For every message which is to be sent VPOP3 calls a function in that script called **CheckFile**. | For every message which is to be sent VPOP3 calls a function in that script called **CheckFile**. | ||
| Line 66: | Line 71: | ||
| Example - don't use SSL when connecting to ' | Example - don't use SSL when connecting to ' | ||
| - | function ServerDetails(params, | + | function ServerDetails(params, |
| if params[" | if params[" | ||
| actions[" | actions[" | ||
| Line 74: | Line 79: | ||
| | | ||
| + | =====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, | ||
| + | |||
| + | * Computed-Mail-From - the Return Path after being processed by VPOP3 (eg using ' | ||
| + | * 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 ' | ||
| + | |||
| + | The function can return a single string value which is the new Return Path to use (if it doesn' | ||
| + | |||
| + | =====Return Code Handling===== | ||
| + | Starting in version 8.8, VPOP3 will call the function **ReturnCodeHandler** every time it receives a return code from the onward MX server. | ||
| + | |||
| + | The function signature is: | ||
| + | **ReturnCodeHandler(LastCommand, | ||
| + | * LastCommand - the last SMTP command sent by VPOP3 | ||
| + | * FullResponse - the latest full response from the ISP. Note that if the ISP gives a multi-line response, this value contains the full response, not just one line of it | ||
| + | |||
| + | The function optionally returns a string which contains the new full response. This must start with a numeric SMTP return code. | ||
| + | |||
| + | This function is intended to be used if the ISP returns inappropriate return codes. For instance, some ISPs return ' | ||