How to set time based rules in Outlook [duplicate]
My employer sends out lots of internal marketing and "aren't we great" emails that I don't read. I currently have a rule which moves the emails sent by the worst offenders to a CompanyName Spam folder in Outlook 2010.
Is there a way to have the emails delete after a period of time, lets say 30 days, without me having to do this manually? Ideally, I'd like a single rule to say: IF it's from [email protected] MOVE to CompanyName Spam AND after 30 days, move to deleted items folder.
I can make a rule to find emails within a particular absolute date range, but not a rolling relative date range (such as today - 30).
To make this even more complicated, if this could be done without VBA, that would be greatly appreciated (as I'm slow at using VBA and encoding)
Thanks,
Solution 1:
If you right click on your 'spam' folder and select Properties, then go to AutoArchive, you should be able to archive emails older than n-days, then select to delete the emails instead of archiving them.
Solution 2:
Create a rule to delete mail after a number of days
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.
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.
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
source