Every time VPOP3 is going to send messages via SMTP Relay, it runs a script called relayout.lua in the VPOP3 directory.
This script may have global variables, depending on your version of VPOP3.
In VPOP3 3.0.0L and later, there are two read-only global variables set at the start of the script:
In VPOP3 5 and later, there is an read/write global variable
In VPOP3 6.7 and later, there are more read/write global variables and a read-only variable
When VPOP3 starts the send process, it calls the function Start which takes no parameters, and has no return value. This can be used for initialisation, or for changing read/write global variables
In VPOP3 v6.7 and later, after VPOP3 has connected to an SMTP relay server, it calls the function ServerConnected which takes no parameters and has no return value. The ConnectedServer global variable is set just before this function call.
Starting in version 5.0.0, VPOP3 will call the function ReturnCodeHandler every time it receives a return code from the ISP's server.
The function signature is: ReturnCodeHandler(LastCommand, FullResponse, LastLine)
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 '4xx' return codes for 'bad recipient', which makes VPOP3 retry sending the message when they should really return a '5xx' return code to tell VPOP3 not to retry the message, and just generate a delivery failure report.
For every message which is to be sent (according to any SMTP Domain filter rules) VPOP3 calls a function in that script called CheckFile.
The function signature is: CheckFile(Filename, Actions, Size, CreationTime, ReturnPath, Recipients, HeaderData, HeaderLines)
The function returns an Actions object saying what to do with the message. If nothing else, the function should return the Actions parameter.
The Actions object contain three values:
A simple function which will stop messages over 10,000,000 bytes being sent between 7am and 7pm, and make messages over 5,000,000 bytes be sent last is below
function CheckFile(filename, actions, size, createtime, mailfrom, recipients, headerdata, headerlines) time = os.date("*t"); if size > 10000000 and (time.hour > 7 and time.hour < 19) then actions["SkipSend"] = 1; end; if size > 5000000 then actions["Priority"] = 1; end; return actions; end;
As an example, if you want messages over 50000 bytes to go through mail sender '0' and all other messages to go through mail sender '1' you could have:
function CheckFile(filename, actions, size, createtime, mailfrom, recipients, headerdata, headerlines) if size > 50000 then if senderid ~= 0 then actions["SkipSend"] = 1; end; else if senderid ~= 1 then actions["SkipSend"] = 1; end; end; return actions; end;