This is an old revision of the document!
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/edited in Settings → Scripts (or in the VPOP3 directory in VPOP3 v6.6 or earlier).
GetCheckCache(“<Domain>”, numRetries, messageSize)
returns true if VPOP3's DNS cache should be used, or false to do a fresh DNS lookup
GetOverrides(“<Domain>”, numRetries, messageSize)
returns DNS Server Map, continue
If continue is false, then VPOP3 will act as if there were no MX/A records defined for this destination
(VPOP3 7.10 and later)
CheckServer(“<Domain>”, “<MX Server>”, numRetries, messageSize, defaultResult)
returns true if the MX server is OK to use, false if it should be ignored
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 '4xx' responses in the last 15 mimutes. It will also hold the message in the Outqueue for 10 minutes, so it isn't immediately resent. (If it is attempted after 10 minutes, and there are still lots of recent failures, it will be held again)
function CheckServer(domain, mxserver, numRetries, messageSize, defaultResult)
if defaultResult then
x = VPOP3.PostgresQuery("SELECT COUNT(*) AS cnt FROM outqueue.sendattempts WHERE server='"
.. mxserver .. "' AND starttime > CURRENT_TIMESTAMP + '-15 MINUTES' AND LEFT(result, 1) = '4'")
if tonumber(x[1].cnt) > 5 then
return false, 10;
end
end
end
(VPOP3 8.6 and later)