This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| reference:lua_smtp_mx_server_rules [2019/03/18 10:48] – [CheckServer] paul | reference:lua_smtp_mx_server_rules [2026/02/24 15:50] (current) – [Lua SMTP MX Server Rules] paul | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Every time VPOP3 checks for remote MX server for sending messages using direct MX sending, it runs a script called **mxserverrules.lua** which can be created/ | Every time VPOP3 checks for remote MX server for sending messages using direct MX sending, it runs a script called **mxserverrules.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/ | ||
| =====GetCheckCache===== | =====GetCheckCache===== | ||
| '' | '' | ||
| Line 21: | Line 26: | ||
| returns true if the MX server is OK to use, false if it should be ignored | returns true if the MX server is OK to use, false if it should be ignored | ||
| + | |||
| + | ===As of VPOP3 8.8 and later=== | ||
| + | |||
| + | If **all** MX servers for a message are filtered out, then the message will not be sent, but will be held in the queue without error (previously the message would be failed in that situation). | ||
| + | |||
| + | A second numeric value can be returned if desired, which will hold the message for that many minutes | ||
| + | |||
| + | These can be used as a throttling system if the receiving mail server is temp rejecting messages | ||
| + | |||
| + | Example - this will stop a message sending if the MX servers have had more than 5 ' | ||
| + | < | ||
| + | function CheckServer(domain, | ||
| + | if defaultResult then | ||
| + | x = VPOP3.PostgresQuery(" | ||
| + | .. mxserver .. "' | ||
| + | | ||
| + | if tonumber(x[1].cnt) > 5 then | ||
| + | return false, 10; | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | </ | ||
| + | =====FinalOverrides===== | ||
| + | (VPOP3 8.6 and later) | ||