I am trying to run a rule in outlook that will forward any new mail that comes into a specific account that will change the subject line and forward the mail to a different account.
I have set up a rule that applies the rule after the message has arrived, which has an attachment, and on this machine only run Project1.ThisOutlookSession.SubjForward except if message body contain 'certain text'
The script looks like this
Sub SubjForward(Item As Outlook.MailItem)
Item.Subject = "New Subject"
Item.Save
Set myForward = Item.Forward
myForward.Recipients.Add "[email protected]"
myForward.DeleteAfterSubmit = True
myForward.Send
End Sub
The rule forwards the message to the new address fine but it keeps on forwarding the same email until I kill the script.
Dose anyone know where I am going wrong?
I have updated further details in the comments below, thanks
Different Accountalso configured with same outlook? - Siddharth RoutSub ChangeSubjectForward(Item As Outlook.MailItem) Item.Subject = "Test 9" Set myForward = Item.Forward myForward.Recipients.Add "[email protected]" myForward.Send end Sub. It works fine except when coming from a gmail account (yahoo,hotmail etc work fine). The account using outlook to auto forward the mail is also a gmail account. So it appears gmail to gmail is causing a problem. The mail comes in to the inbox, forwards to the outbox then disappears from the inbox and repeats until script is killed - Henrick