Search code examples
emailoutlook-2010rule-engine

Move, sent email to folder


Is there a way to move sent emails from the sent folder to another folder if it's sent to a certain address. Outlook rule editor for Outlook-2010 only allows to Move AND Copy when choosing to apply rule to messages that have been sent. (while messages received allows for only moving.)


Solution

  • The SaveSentMessageFolder property of the MailItem class allows to set a Folder object that represents the folder in which a copy of the e-mail message will be saved after being sent. So, the message will be placed to the correct folder.

      Sub SetSentFolder() 
       Dim myItem As Outlook.MailITem  
       Dim myResponse As Outlook.MailITem 
       Dim mpfInbox As Outlook.Folder 
       Dim mpf As Outlook.Folder 
    
       Set mpfInbox = Application.Session.GetDefaultFolder(olFolderInbox) 
       Set mpf = mpfInbox.Folders.Add("SaveMyPersonalItems") 
       Set myItem = Application.ActiveInspector.CurrentItem 
       Set myResponse = myItem.Reply 
       myResponse.Display 
       myResponse.To = "Eugene Astafiev" 
       Set myResponse.SaveSentMessageFolder = mpf 
       myResponse.Send 
      End Sub