User Tools

Site Tools


reference:user_routing_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:user_routing_script [2015/03/10 09:48] paulreference:user_routing_script [2023/03/27 11:32] (current) paul
Line 42: Line 42:
 <code> <code>
 --Don't forward any messages from any *@localdomain.com addresses --Don't forward any messages from any *@localdomain.com addresses
-if (string.find(Sender, "@localdomain%.com$"))+if string.find(Sender, "@localdomain%.com$"then
   ShouldForward = false;   ShouldForward = false;
 end end
 </code> </code>
  
-====If  the sender is user@domain.com forward to person@mycompany.com====+====If the sender is user@domain.com forward to person@mycompany.com====
  
  
 <code> <code>
 --If  the sender is user@domain.com forward to person@mycompany.com --If  the sender is user@domain.com forward to person@mycompany.com
-if (string.lower(Sender) == "user@domain.com")+if string.lower(Sender) == "user@domain.com" then
   Forwards = "person@mycompany.com";   Forwards = "person@mycompany.com";
   UseForwards = true;   UseForwards = true;
Line 59: Line 59:
 </code> </code>
  
 +====If the time is currently in the morning, override the assistant to send to someone else====
 +
 +<code>
 +now = os.date("*t"); --https://www.lua.org/pil/22.1.html
 +if now.hour < 12 then
 +  Assistants = "otheraddress@example.com"
 +end
 +</code>
 +
 +====If the current time is between 10:00 on 2nd March 2023 and 17:00 on 5th March 2023, then forward====
 +
 +<code>
 +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
 +</code>
reference/user_routing_script.1425980921.txt.gz · Last modified: 2018/11/14 10:44 (external edit)