Table of Contents

LAN Forwarding Scripting

(Added in V8.7)

This is stored in the 'LanForwarding.lua' script in Settings → Scripts

There are two global variables set:

* MessageType2 - if MessageType is “check”, this contains more information about the stage of internal processing

In “check”, the original return path address may not be known, the script may be called many times. It will be a new instance of the script each time. Only the “PreprocessRules” function will be called in this state

In “message” or “internal”, there is once instance of the script per recipient- “PreprocessRules” is called first, then “GetReturnPath” is called if the message will be LAN Forwarded.

There are two functions:

PreprocessRules

This allows the script to see and potentially modify LAN Forwarding Rules

PreprocessRules(return path, recipient, check mode, mail collector, recipient local part, recipient domain, rules)

The function can return a modified 'rules' table containing new rules to check while processing this message. If it returns nothing, the original rules will be used.

GetReturnPath

This allows the script to modify the SMTP Return Path used when sending the message using LAN Forwarding. It is called when the message is added to the LAN Forwarding queue

GetReturnPath(return path, original recipient, target recipient, mail collector, target server, rule id, rule comment, run extra data)

The function should return a new return path (if nothing is returned, the original return path is used)

Currently “rule comment” and “rule extra data” will be blank, unless specified by the “PreprocessRules” function

Target Server is one of: