User Tools

Site Tools


reference:lua_smtp_relay_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_relay_control [2010/05/04 15:09] paulreference:lua_smtp_relay_control [2018/11/14 10:45] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ======Lua SMTP Relay Control====== ======Lua SMTP Relay Control======
  
-Every time VPOP3 is going to send messages via SMTP Relay, it runs a script called **relayout.lua** in the VPOP3 directory. For every message which is to be sent (according to any SMTP Domain filter rules) VPOP3 calls a function in that script called **CheckFile**.+Every time VPOP3 is going to send messages via SMTP Relay, it runs a script called **relayout.lua** in the VPOP3 directory
 + 
 +====Global Variables==== 
 +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: 
 +  * senderid - this is the numeric message sender configuration id (starting at 0) 
 +  * sendername - this is the name you gave to the message sender configuration in VPOP3 
 + 
 +In VPOP3 5 and later, there is an read/write global variable 
 +  * UseBATV - this is a boolean value saying whether to [[http://en.wikipedia.org/wiki/Bounce_Address_Tag_Validation|BATV]] encode the return path address 
 + 
 +In VPOP3 6.7 and later, there are more read/write global variables and a read-only variable 
 +  * MaxMessagesPerConnection - The maximum number of messages to send in this connection 
 +  * MaxRecipientsPerConnection - The maximum number of recipients to specify in this connection 
 +  * MaxRecipientsPerMessage - The maximum number of recipients to send each message to 
 +  * ConnectedServer (read only) - The server name which VPOP3 has connected to (set just before the ServerConnected function call) 
 +=====Initialisation===== 
 +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. 
 +=====Return Code Handling===== 
 +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)** 
 +  * 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 
 +  * LastLine - the last line of the response from the ISP 
 + 
 +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 codesFor 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. 
 + 
 +=====Messages to be sent===== 
 +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: The function signature is:
Line 39: Line 74:
 end; end;
 </code> </code>
- 
-In VPOP3 3.0.0L and later, there are two global variables set at the start of the script: 
-  * senderid - this is the numeric message sender configuration id (starting at 0) 
-  * sendername - this is the name you gave to the message sender configuration in VPOP3 
  
 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: 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:
Line 49: Line 80:
 function CheckFile(filename, actions, size, createtime, mailfrom, recipients, headerdata, headerlines) function CheckFile(filename, actions, size, createtime, mailfrom, recipients, headerdata, headerlines)
  
- time = os.date("*t"); 
  if size > 50000 then  if size > 50000 then
   if senderid ~= 0 then   if senderid ~= 0 then
reference/lua_smtp_relay_control.1272982162.txt.gz · Last modified: 2018/11/14 10:44 (external edit)