How to move Auto Forwarded mails to a folder in Outlook 2013

Another big problem not address normally (which should have been) by MicroSoft.

If you want to create rule for mails that are auto forwarded from someone to you, you cannot my simple means. It would have been great if MS has provided a straight forward option in rules setup to identify those mails which are auto forwarded, provided the document has a property called “Auto Forwarded”. (This you can verify by adding column of “Auto forwarded” by going to View Setting -> Columns and then selecting Auto forwarded — This will add a column with title “Auto Forwarded” and will show a tick mark for mails which are auto forwarded).

So, what now?

After digging for two days, I found a solution — By creating a script and assigning it to the rule.

Press Alt + F11 to open up the Visual basic editor, double click on ThisOutlookSession object, and create a procedure with following signature:

Public Sub YourProcName (Item As Outlook.MailItem)

'code

End Sub
vba
vba

Now put following code in your procedure:

Public Sub MyAutoForwardRule(Item As Outlook.MailItem)

    Dim myNameSpace As Outlook.NameSpace
    Dim myInbox As Outlook.MAPIFolder
    Dim myDestFolder As Outlook.MAPIFolder

    Set myNameSpace = Application.GetNamespace("MAPI")
    Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)

    ' Assumes destination folder is directly under the Inbox
    Set myDestFolder = myInbox.Folders("AF_Mails")

    If Item.AutoForwarded Then
        'move message
        Item.Move myDestFolder
    End If

    Set myDestFolder = Nothing
    Set myInbox = Nothing
    Set myNameSpace = Nothing

End Sub

So, the programming part is over.

  1. Now create a new rule.
  2. Select “Apply rule on messages I receive” and click next
  3. Select “From people or public group”, and select the person who auto forwards you mails, click next
  4. Select “Run a script”. A box will appear with all public procedures in you VBA. Select procedure that you just created above.

    Select Script
    Select Script
  5. Save your rule

and, Enjoy!!

Author: ashishtilak

I am happy go lucky kinda person. Always smiling and making people smile. Luv every thing life has to offer. And, I am a software engg. too, working at a manufacturing company. See more about myself in my blogs.

10 thoughts on “How to move Auto Forwarded mails to a folder in Outlook 2013”

  1. Hi,

    this works perfectly. The only problem is that I am not able to change the destination folder and I do not want to keep it in my inbox because in this way I still continue to have it in the BlackBerry.

    I want to move it in a folder which is saved in my hard disk and mark it as read. It is possible?

    Many thanks for your help

  2. Which part of the script/rule do I set the folder I want the forwarded emails to be moved to? How do I set them? Thanks!

  3. Hi Sapphire,

    Replace the name of folder “AF_Mails” to the name of your folder in following line:
    Set myDestFolder = myInbox.Folders(“AF_Mails”)

    However, for this, you must have your auto forward folder to be in the “Inbox” folder.

  4. Hi – I do not have the option of “Apply rule on messages I receive” I only have “Apply this rule after the message arrives”. Is there anything I need to change in the code to accommodate this? Also, are there to procs or only one?

  5. Hi Rose. “Apply this rule after the message arrives” will work fine with this script. You only need to change “AF_Mails” to whatever folder you want your auto-forwarded mails to go (must be inside the inbox).

    Hope this helps.

  6. Hi. I may need some help to get this to work. I’m a novice at this🙂
    After i have opened VBA, and dob click on ThisOutlookSession object i just write in this, or do i have to change something?:

    Public Sub YourProcName (Item As Outlook.MailItem)

    ‘code

    End Sub

    After that i write this in the same window under the last procedure, or do i have to change something?:

    Public Sub MyAutoForwardRule(Item As Outlook.MailItem)

    Dim myNameSpace As Outlook.NameSpace
    Dim myInbox As Outlook.MAPIFolder
    Dim myDestFolder As Outlook.MAPIFolder

    Set myNameSpace = Application.GetNamespace(“MAPI”)
    Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)

    ‘ Assumes destination folder is directly under the Inbox
    Set myDestFolder = myInbox.Folders(“AF_Mails”)

    If Item.AutoForwarded Then
    ‘move message
    Item.Move myDestFolder
    End If

    Set myDestFolder = Nothing
    Set myInbox = Nothing
    Set myNameSpace = Nothing

    End Sub

    Can i now apply the rule and all is ok, or do i have to something else, such as make a folder in my inbox with AF Mails?

    Thanks, Ole

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s