Fulvio needs to use rules to move sent messages, but the sent items are not marked read when they are copied to other folders.
I’ve set up a rule for copying any message I send out to a local outbox folder (rather than the one on remote server). Therefore, I’ve uncheck the standard option “save a copy of sent messages”, as I don’t need to duplicate them remotely. Everything works fine: I have no longer remote copies of sent emails, and I have the local ones, but these latter are now bolded as unread. So, I’d like to set my custom rule as: copy sent messages to the local outbox AND mark them as read. Yet it seems to be impossible….
It's not impossible to do, but it won't work with Rules. "After Sending" rules don't support custom actions, run a script, or marking items as read. However, you can use VBA to mark sent items read.
Because the sent item is not in the default data file, you'll need to use the code at Use a folder in another pst or Mailbox to identify the data file. Paste it and the code below into the ThisOutlookSession module in the VB Editor.
Change this line: Set Items = GetFolderPath("New PST\Sent Items").Items to reflect the data file name in the folder list and the folder name you are moving the sent item to.
Code Sample: Mark Moved Messages as Read
To test this code, click in the Application_Startup module and press Run to start it without restarting Outlook. Don't forget to get the GetFolderPath function from Use a folder in another pst or Mailbox.
Private WithEvents Items As Outlook.Items Private Sub Application_Startup() Set Items = GetFolderPath("New PST\Sent Items").Items End Sub Private Sub Items_ItemAdd(ByVal Item As Object) Item.UnRead = False Item.Save End Sub
Mark deleted items read automatically
To mark messages read as they are moved into a folder within the mailbox, such as the deleted items folder, use the following code sample.
To use the junk mail folder, use
Set Items = Ns.GetDefaultFolder(olFolderJunk).Items
Private WithEvents Items As Outlook.Items Private Sub Application_Startup() Dim Ns As Outlook.NameSpace Set Ns = Application.GetNamespace("MAPI") Set Items = Ns.GetDefaultFolder(olFolderDeletedItems).Items End Sub Private Sub Items_ItemAdd(ByVal Item As Object) Item.UnRead = False Item.Save End Sub
Move sent messages using VBA
This code sample moves the sent messages using VBA, rather than a rule.
If the folder you are moving the sent items to is in a different pst file, you'll need the GetFolderPath function at Use a folder in another pst or Mailbox.
Private WithEvents Items As Outlook.Items Private Sub Application_Startup() Set Items = Session.GetDefaultFolder(olFolderSentMail).Items End Sub Private Sub Items_ItemAdd(ByVal Item As Object) Set MovePst = GetFolderPath("NewPST\Sent Items") Item.UnRead = False Item.Move MovePst End Sub
How to use the Macro
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security. If Outlook tells you it needs to be restarted, close and reopen Outlook. Note: after you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Now open the VBA Editor by pressing Alt+F11 on your keyboard.
To use the macro code in ThisOutlookSession:
- Expand Project1 and double click on ThisOutlookSession.
- Copy then paste the macro into ThisOutlookSession. (Click within the code, Select All using Ctrl+A, Ctrl+C to copy, Ctrl+V to paste.)
Application_Startup macros run when Outlook starts. If you are using an Application_Startup macro you can test the macro without restarting Outlook by clicking in the first line of the Application_Startup macro then clicking the Run button on the toolbar or pressing F8.
More information as well as screenshots are at How to use the VBA Editor.