PDA

View Full Version : Re: Outlook Forwarding Script Errors Out and Stops Rule



dipique
11-14-2013, 12:55 PM
I use a rule in Outlook to run a script on every received e-mail that forwards it. It always works for a couple days, but then I get a message that says "rule encountered an error", and then I have to reactivate the rule manually.

I'd love to figure what is causing the error, but at the very least, I'd like whatever item caused the error to just be skipped.

Here's the code:


Sub DoForward(Item As Outlook.MailItem)
On Error Resume Next

'Grab the item and create a forward
Dim myFwd As Outlook.MailItem
Set myFwd = Item.Forward

'Set my e-mail as the recipient
myFwd.Recipients.Add "email@email.com"

'Set the sent e-mail to delete after sending
myFwd.DeleteAfterSubmit = True

'And send it off
myFwd.Send

'Clean-up
Set myFwd = Nothing
End Sub



Any ideas would be appreciated. Thanks!

Dan

skatonni
11-14-2013, 08:56 PM
Instead of a rule you could try ItemAdd or NewMailEx.

http://www.outlookcode.com/article.aspx?id=62

dipique
11-15-2013, 07:25 AM
Instead of a rule you could try ItemAdd or NewMailEx.

http://www.outlookcode.com/article.aspx?id=62

Thanks; I will try testing these alternatives.

Any idea why my code might generate an error? I've tried looking at the mail I've received and I haven't seen a common theme. At first I assumed it was mail with large attachments or something of that sort.