Forwarding Emails with Scripts

I am trying to set my emails to all forward to another address. It is a work email so I cant just sign in in a different place.

I'm trying to configure rules and the standard command simply redirects so they don't enter my inbox at all. Ive tried using the script:


require ["copy", "fileinto"];
if true
{
  redirect :copy "example@gmail.com";
}

However this throws up an error:

Error(Line1): invalid command: require

If anyone knows what is wrong with my script id be very grateful. Similarly if anyone can suggest a work around?

July 24th, 2015 8:51am

I'm trying to configure rules and the standard command simply redirects so they don't enter my inbox at all.

How did you configure the rule? Did you select the "redirect it to people or public group" as the rule action? Please try using "forward it to people or public group" action instead.

Since we are not the best resource for coding, if you want to achieve this via script, I'd recommend you post a new question in the following forum:

https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

Steve Fan
TechNet Community Support

Free Windows Admin Tool Kit Click here and download it now
July 27th, 2015 2:32am

Thanks for your reply. Somehow I had found myself in a different rule editor. It had no option to forward, only redirect. I assumed the script editor was the only way forward. I have since found the correct rule editor. Lets see if it works :)
July 27th, 2015 5:39am

I'm afraid no luck. The emails still come into my inbox but they aren't automatically forwarded on. (If I open up rules and alerts I can press run rules now and it applys the rule to everything that has already been received so it is doing the right thing)

The rule description is:

Apply this rule after the message arrives

forward it to example@gmail.com

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 9:20am

Thank you for the update. Do you have any other rules set so that one of them may conflict with the forwarding rule? Please try disabling all rules except the forwarding rule and then test it again.

If still no luck, please also try deleting the rule and then creating the forwarding rule within the webmail interface of your email account.

Please let me know the result.

Regards,

Steve Fan
TechNet Community Support

August 4th, 2015 10:49pm

There were defiantly no other rules conflicting, the only other rule removed the category assigned to incoming emails. Even with it disabled, no luck. 

It is a work email address but I found the rules option for interface as opposed to outlooks. I assume this is the equivalent to the Webmail Interface. 

This is what I had found originally and could only progress further by editing the script.

I have however found the (supposedly) correct script syntax to solve my problem. 

if true 
{
  redirect "example@gmail.com";
  keep;
}

It seems simple now but I could not find this anywhere online.

Ill let you know if it works out.

Free Windows Admin Tool Kit Click here and download it now
August 11th, 2015 6:12am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics