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.
More Information
More VBA samples that mark moved message as read are at:
Marking Sent Items as Read How to mark messages read when they are moved to multiple folders (WindowsITPro)
E-Mail: Mark as read Mark as read when moved to a subfolder of the Inbox (vboffice.net)
I'm trying to combine two of the above subs and mark both the sent items and deleted items as read. But can only get one to work at a time. Here is what I have:
I'm hoping to use this in combination with a rule to move a copy of each sent email to my inbox (as noted here: https://www.makeuseof.com/tag/auto-cc-bcc-outlook-gmail/ ) and automatically marking them as read, but am not quite sure how to update the example rule above to account for that. Can you point me in the right direction?
I think you'll need to use an item add macro to mark messages to you, sent from you, as read.
Don't be stupid, Outlook has an option on the sent items, above the search section there are options, All, Unread and others. just click on the unread option then select the item that you don't want to appear as unread, and that's it.
it's easier just to select all and mark all as read - but why do it manually when you can automate it?
This was really helpfull Diane. Thank you. i got it working with a combination of "Move sent messages using VBA" and "Mark Moved Messages as Read" with 10+ folders. Works like a charm
I am struggling to get this to work within Outlook 2010 - i have an IMAP account and the Outlook Data File set as default - yet anything that is copied into the sent items of the Data File is still unread. What could I be doing wrong?
Are you using the macro to mark the messages as read? What are you using for Set Items = GetFolderPath("New PST\Sent Items").Items ? It should be the display name of the data file, as seen in the folder list and the name of the sent folder - should be Sent Items if a pst file, could be something else in an IMAP account. You also need macro security on low for the macro to run.
This is what I have so far - I cannot seem to get the Function right
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Set Items = GetFolderPath("Outlook Data FileSent Items").Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
Item.UnRead = False
Item.Save
End Sub
what happens when you try? Did you add the function at the end of the module (or in a new module named Functions? ) https://www.slipstick.com/developer/working-vba-nondefault-outlook-folders/#GetFolderPath
Assuming the missing slash in the path is wordpress's fault -
Set Items = GetFolderPath("Outlook Data FileSent Items").Items
actually it happens when we make new pst in same outlook,Though the above solution provided is ok,but we can do one more thing to remove existing pst,and restart outlook.. then all emails configuration will get download in new pst ... and then you can add removed pst in outlook .. hope it will work correctly
Thank you for your help, unfortunately I cannot seem to get it to work. I must be doing something wrong. I created a rule to automatically move emails from my inbox to a subfolder on a second OST file. I wish for it to be marked as "READ" as soon as it is moved but no luck. Please help
sorry I missed this earlier. You need to reference the second date file:
Private Sub Application_Startup()
Set Items = GetFolderPath("other@ost.name\Foldername").Items
End Sub
Hi Diana,
Thanks for script. I have tried to use the script without success. My case is the following:
⢠I checked out save forwarded messages and save copies of messages in the sent items folder from outlook options
⢠I created a rule which apply after I send a massages to move a copy to "sent items" folder for massages which assigned a specific category
⢠The rule works fine, but when the messages moved to the âsent itemsâ folder, it shows âunreadâ
⢠Can you help me to write a script to make it âreadâ once the massages moved to the âsent itemsâ folder
Thanks
AbdulSalam
The script needs to look at the folders you move the messages to - if its the default sent items folder, you'd use this as the app startup macro to watch the sent items folder:
Private Sub Application_Startup()
' this is the folder the rule is moving sent messages to
Set Items = Session.GetDefaultFolder(olFolderSentMail).Items
End Sub