I have a web application that sends me many emails that are only for notification purposes - and so, are not important. There can be a great deal of these per day, and I sometimes forget to delete them.
I am using a Microsoft Exchange mail server, and do not have administrator rights to it.
Is there a way I can set up/configure from Outlook a procedure that deletes emails from a specific sender after an amount of time?
5 Answers
I accomplished this by creating a new rule that automatically moved all emails from a specific sender into a folder.
This folder then had AutoArchive (Right click folder, Properties) set up to permanently delete items older than x days.
Using the outlook scheduler you can add a task to delete all emails from folders older than a certain amount of time. Also in the same rule you can empty the trash of all items older than a certain amount of time. Automate when it runs and you have solved your problem. On my mac the scheduler lives under the tools menu.
Here's another way to do this natively via Outlook that's not posted here. I've referenced and quoted the source to preserve the content here since I've found this detail helpful in helping others with this same task in the past in both a business and home based environments.
0Create 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
This is for Microsoft Office Outlook 2007 running on Windows 7
This is a 2 step process.
First you have to turn on the Global Auto Archive option. (assuming you are not using AutoArchive presently)
In Outlook menu Tools:Options.
Select "Other" tab.
Select "AutoArchive..." button.
Here we turn on the global Auto Archive function (so we can setup individual folder (deleted items) options.
If you do not use AutoArchive, and you only want to delete your old Deleted Items, the only check box that should be selected is: Run AutoArchive every XX days. Select this check box and put in a number less than or equal to the time you want your trash can to remove old items. For example, if you want your Deleted Items (trash can) to get rid of items that are older than 2 months, you could select "30" days in this Global AutoArchive. What is really happening is that this Global AutoArchive is going to trigger every 30 days, which will trigger the AutoArchive on the Deleted Items that we are going to setup next.
The section under "During AutoArchive:" you don't want any of those check boxes selected. These are for global settings, and will have an effect on all your email folders.
click the OK button to accept those changes (closes window), then click OK again on Options control panel.
Now we will setup the trash can AutoArchive options.
If you right click the trash can (Deleted Items) in Outlook, select Properties.
Select the AutoArchive tab.
Select radio button: Archive this folder using these settings.
There you can select how long to keep the emails in the trash (you can select the number of months weeks or days.
Then select the sub radio button: Permanently delete old items.
(other options include move old items to default archive folder, or move old items to a local directory.
I hope this was helpful
REAndy
The VBA is the simplest way, but the autoarchive is an unneeded step. In addition to enabling macros for testing you will also need to add the following to HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security
EnableUnsafeClientMailRules DWORD 1to turn on the "Run a script" option in the rules.
With that done, just use the following script to delete messages older than 2 weeks:
Sub SetDelete(Item As Outlook.MailItem)
If ((Item.ReceivedTime) < DateAdd("ww", -2, Date)) Then Item.Delete
End If
End SubYou can change the DateAdd() function to suit the time period that is considered "old enough" to delete. Here is one of many references for the arguments for that function.
(I set this up for my daily e-mails from USPS telling me what is being delivered. USPS only has a 2 week span looking back at delivered mail items so after 2 weeks the e-mail notification is useless.)