If there is a <username>/user_redirect.lua script, this Lua script can override VPOP3's message routing options. You can edit this either in the Settings → Scripts page in the settings, or via the 'Routing' tab in the user's settings in the VPOP3 administration console. This script affects how VPOP3 will handle how messages to this user are handled. (Messages from this user are not affected by the script at all).
If that script doesn't exist, but there is a user_redirect.lua script, that Lua script will be used instead.
When the user_redirect.lua script is run there are several global variables set:
The BigRedirect and SmallRedirect variables are tables with 4 entries:
All the above settings can be changed by the script to alter the routing (the changes will only apply for this message, not future messages)
There are also some global variables which should be treated as read-only - any changes to them will be ignored outside the Lua script
Please note - the only help we will give with Lua with our free support is to clarify the Lua interface (eg function signatures etc), we will not give help with Lua in general or help you to write or debug your own Lua scripts. We can help with that, but it will be on a chargeable basis depending on the complexity of the issue. Contact us for more information.
--Don't forward any messages from any *@localdomain.com addresses if string.find(Sender, "@localdomain%.com$") then ShouldForward = false; end
--If the sender is user@domain.com forward to person@mycompany.com if string.lower(Sender) == "user@domain.com" then Forwards = "person@mycompany.com"; UseForwards = true; ShouldForward = true; end
now = os.date("*t"); --https://www.lua.org/pil/22.1.html
if now.hour < 12 then
Assistants = "otheraddress@example.com"
end
now = os.date("%Y-%m-%d %H:%M")
if (now >= "2023-03-02 10:00") and (now <= "2023-03-05 17:00") then
Forwards = "person@mycompany.com";
UseForwards = true;
ShouldForward = true;
end