User Tools

Site Tools


reference:lua_smtp_server_script

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_server_script [2025/05/08 09:22] – [SMTP Server Lua Scripting] paulreference:lua_smtp_server_script [2026/05/29 11:39] (current) – [LoadLimits()] paul
Line 1: Line 1:
 +=====End()=====
 +''End()''
 +
 +This function is called by VPOP3 when the SMTP service session ends
 +
 ======SMTP Server Lua Scripting====== ======SMTP Server Lua Scripting======
  
Line 10: Line 15:
   * **Start()** - called when the SMTP service session starts up, before the welcome message is sent to the SMTP client   * **Start()** - called when the SMTP service session starts up, before the welcome message is sent to the SMTP client
   * **RBLResults()** - (VPOP3 Enterprise Only) - called after the RBL checks have been performed   * **RBLResults()** - (VPOP3 Enterprise Only) - called after the RBL checks have been performed
-  * **CanConnect()** - (v8.7+) - called at connection to be able to dynamically alter service load limits+  * **LoadLimits()** - (v8.7+ Enterprise Only) - called at connection to be able to dynamically alter service load limits
   * **GetMaxMessageSize()** - called at startup, and when the HELO and EHLO commands are received   * **GetMaxMessageSize()** - called at startup, and when the HELO and EHLO commands are received
   * **GetEHLOCapabilities()** - called when the EHLO command is received   * **GetEHLOCapabilities()** - called when the EHLO command is received
Line 275: Line 280:
  
 This function is called by VPOP3 when the SMTP service session ends This function is called by VPOP3 when the SMTP service session ends
 +
 +=====LoadLimits()=====
 +Added in v8.7
 +
 +  function LoadLimits(threadCounts, ipAddress, cpuLoad, spamfilterDuration)
 +  
 +(cpuLoad & spamfilterDuration added in v9.1)
 +
 +This function is called by VPOP3 when an SMTP session is about to start to determine whether the load limiting should allow it
 +
 +  * threadCounts = table of settings & counts
 +    * ThreadCount = total number of SMTP sessions
 +    * ThisClientThreadCount = number of SMTP sessions from this IP Address
 +    * ReservedAddresses = reserved addresses from settings
 +    * Response = (output) SMTP response if connection is to be rejected outright
 +    * MaxIncomingServerThreads = from settings
 +    * MinIncomingServerThreads = from settings (added in v9.1)
 +    * DynamicIncomingServerThreads = from settings (added in v9.1)
 +    * MaxLocalServerThreads = from settings
 +    * SingleAddressLimit = from settings
 +    * SingleAddressLimitLocal = from settings
 +    * ReservedThreads = from settings
 +    * LocalClient = boolean - is IP address local
 +  * ipAddress = client IP address
 +  * cpuLoad = CPU load % (0-100)
 +  * spamfilterDuration = average spam filter processing duration over last minute (in milliseconds)
 +
 +The function should return the 'threadCounts' table, potentially modified.
 +
 +If 'Response' contains text, then VPOP3 will return this response to the client and close the connection. It should begin with a valid SMTP response code, eg '421' to indicate a temporary problem
 +
 +If 'Response' is blank, then VPOP3 will continue with the normal load limiting processing, using the new settings from the returned threadCounts table.
reference/lua_smtp_server_script.1746692522.txt.gz · Last modified: by paul