(VPOP3 v6.5 or later)
If there is a <username>/delivery.lua script, this Lua script can override VPOP3's message delivery options. You can edit this in the Settings → Scripts page in the settings. This script affects how VPOP3 will handle how messages being delivered to this user are handled.
If that script doesn't exist, but there is a delivery.lua script, that Lua script will be used instead.
The script can contain two functions “PreDeliver” and “DeliverMessage”. These functions are called with no parameters, but will have access to global variables containing information about the message and can modify global variables to alter the way the message delivery is handled.
(Prior to v6.20, only the DeliverMessage function is used)
PreDeliver is called at the beginning of the delivery process, after Message Rules have been handled. It can modify any globals, but only the Quarantine, Forwards, HeaderMods, ForwardingSenderAddress and ForwardingSenderText globals are read after it has been called. Any other changes made by this function will be left unchanged and will be processed after the DeliverMessage function is called.
DeliverMessage is called in the middle of the delivery process, as long as the message is still being delivered into at least one message folder.
If the message is quarantined or Message Rules have indicated that it is not to be delivered to any folders, then it will not be delivered further so DeliverMessage will not be called.
Note that the script can do other things as well, such as saving the message contents elsewhere (using the 'Filename' variable) or calling an external program, or whatever. If the script doesn't alter the global variables, the message will be delivered just as if the script hadn't been called.