You can combine a Rules Wizard rule with the AutoArchive feature of Microsoft Outlook to automatically delete messages as they age. There are two ways you can do this:
- Create a rule that moves messages meeting certain criteria to a folder. Configure the folder's Archive setting to delete messages.
- Setting an expire date on messages as they arrive.
In either case, AutoArchive will delete the messages for you once they age.
If you need help configuring autoarchive settings, watch the tutorial: Configuring AutoArchive settings in Microsoft Outlook.
Note: If you use Microsoft Exchange Server 2010 with online mailbox archives, you won't be able to use autoarchive in Outlook 2007 and 2010.
Set an expiration date on the messages
Follow these steps to create a run a script rule to add an expire date and then configure AutoArchive to delete the messages.
When a message is expired it's displayed in the message list in a gray strikethrough font.
Check macro security settings. Macro security should be set to Low during testing. Once you verify the macro works, you can use SelfCert to sign the macro, at which point you will change the security setting to allow signed macros only.
In Outlook 2010 and 2013, click File, Options, Trust Center. Click the Trust Center Settings button then Macro Security. Select the bottom option for Low security. In Outlook 2007, look on the Tools menu for Trust Center, then Macro Security. In older versions of Outlook, go to Tools, Macros, Macro Security.
- Press Alt+F11 to open the VBA Editor.
- Right click on Project1 and choose Insert > Module
- Add the macro below to the new module.
- Create a rule, selecting Run a Script as the action. If you set all of the conditions in the rule, you can delete the If...Then and End If lines.
- Create a filter for your view that hides expired messages between AutoArchive runs.
- Configure AutoArchive to delete expired messages.
The macro will set the message to expire in 1 day. You can use .5 to expire the message after 12 hours.
If you use conditions in the rule to filter the messages, you can remove the If...Then and End If lines from the code.
Sub SetExpire(Item As Outlook.MailItem) If Left(LCase(Item.Subject), 7) = "weather" Then Item.ExpiryTime = Now + 1 Item.Save End If End Sub
Move messages to a new folder
- Create a rule that moves messages to a folder.
- Switch to this folder, then right click on the folder and choose Properties.
- On the AutoArchive tab, choose how often to clean out items and whether they should be archived or deleted.
More Run a Script Samples:
- Autoaccept a Meeting Request using Rules
- Automatically Add a Category to Accepted Meetings
- Blocking Mail From New Top-Level Domains
- Convert RTF Messages to Plain Text Format
- Create Appointment From Email Automatically
- Delegates, Meeting Requests, and Rules
- Forward meeting details to another address
- How to Change the Font used for Outlook's RSS Feeds
- How to Process Mail After Business Hours
- Keep Canceled Meetings on Outlook's Calendar
- Move messages CC'd to an address
- Open All Hyperlinks in an Outlook Email Message
- Outlook AutoReplies: One Script, Many Responses
- Outlook's Rules and Alerts: Run a Script
- Process messages received on a day of the week
- Read Outlook Messages using Plain Text
- Receive a Reminder When a Message Doesn't Arrive?
- Run a Script Rule: Change Subject then Forward Message
- Run a script rule: Reply to a message
- Run a Script Rule: Send a New Message when a Message Arrives
- Run Rules Now using a Macro
- Run-a-Script Rules Missing in Outlook 2016
- Sort messages by Sender domain
- To create a rule with wildcards
- Use a Rule to delete older messages as new ones arrive