Automated email deletion

Is anyone familiar with an app or plugin that will help me with automated email deletion in Mail?

Multiple times a day I receive emails from the NY Times, Washington Post, several photography sites, and other websites, and they’re filling my mailbox. I’m hoping to find an app that will allow me to set a schedule that will periodically move these items to the Trash. For instance, if a particular email from a specified sender hasn’t been read in 5 days, move it to the trash. Is anyone familiar with anything like this?

I’m guessing that I could write an AppleScript to do this, but I’d have to learn AppleScript first. :grin:

I think you can do this in Apple Mail:


Add Rule

Description “taking out the trash”

If all of the following conditions are met:

Sender is a member of group “trashable”
Date received is greater than “5” days old

Perform the following actions:

Delete Message

You would have to create a group called “trashable” that had the appropriate senders in it. Mail gives you other options that would be more automated (such as “sender is not in my contacts”) but that might be a bit risky.


I wrote something very similar to that a few days ago, and it simply doesn’t work. :weary:

I use a few different methods… first is to hit the unsubscribe links for those things to make them stop. For any that that does not work for, or that I just do not want in my inbox, I made a filter that takes it from my inbox and moves it to a ‘news folder’… or Trash if that’s your desire.

The simplest way to make a filter is to open an example email you want to filter, then go to Mail:Preferences:Rules and edit and existing rule or add a new one. When you then hit the plus to add a new line it will fill in the From details of the open message.

Rules are finicky, make them as simple as possible to start. Note that ‘any’ and ‘all’ at the top have very different effects :wink:



I think your filter will only work when you run it manually.

Try changing the filter to not be date oriented and just change the color. See if that works on new, unread, messages.

1 Like

I agree that there needs to be a trigger to make it run, which is why I was thinking of an AppleScript that I can put it in CRON or something.

In this instance, the date is the key. Otherwise, it would delete new articles.

Have you checked the addresses to see if all these emails are actually coming from the New York Times, etc.? Some of them could be spam from scammers. In addion to the unsubscribe feature in Apple Mail, the NYT, WP, and other reputable companies have unsubscribe links in emails from their lists. If you did not actually subscribe to a particular list, check the address it’s mailed from to make sure it’s not a fake. I’ve gotten, and continue to get, some really valid looking emails that didn’t check out once I checked the addy. If this the case, filters won’t help much as spammers keep varying the addresses they use. Server side blocks from your ISP might be better.

Does your filter work if you select all messages in the mailbox and choose the menu Message > Apply Rules?


Unfortunately it’s not, and I’ve moved it to the top of the list of Rules, to ensure that nothing else is interfering with it.

Yep, they’re all legitimate emails from the WaPo and NYT, that I subscribe to, and want. However, if I haven’t gotten to the email(s) in a few days, then they’re old news and I’d like to delete them.

I do this in a sort of analog way: have created one smart mailbox for email from NYT, WaPo, et al, and once a week or so, go through and mass-delete the older ones. There is just so many of them, it would be nice to have an automated way to do this for the exact reason you mention, after several days, the emails are fish-wrap.

I decided years (decades?) ago that in terms of mailing lists, disk space is cheap and tidiness is expensive. I autosort each mailing list into its own folder, and I don’t bother deleting anything. It accumulates, and for some of the very active lists, I ‘read’ them every now and again by searching for things or senders of interest. For the others, I can quickly scan the recent subject lines to see what’s up, and maybe even open a few and read them.

If space does get to be a problem due to attachments, you can clobber old stuff once or twice a year.

But if you value tidiness more than I do you might look at Mail Suite. It adds lots of features to Mail, including many more rule types. Unfortunately, they now bundle what used to be several separate plugins into one purchase, so it’s more expensive than it once was–$60.

Ah yes, I’m very familiar with Small Cubed and their products. I stopped using them awhile back as they ceased to work with Mojave, if I remember correctly. I can now upgrade for $30. May be something to consider.

Do you sort them into their own folders in your “On My Mac” section, or still on your email server?

I like that idea, but I do periodically sweep things into “On My Mac” to get them off my server - one of my accounts has limited space.


Diane D wrote: “Do you sort them into their own folders in your “On My Mac” section, or still on your email server?”

On the server to begin with (some of the filters are on fastmail, some are on a mac at home.) But I periodically move most of my mail locally off of fastmail to “on my mac”, not for lack of space, but because if it’s only in the cloud, it isn’t mine, and I don’t particularly want to keep years of stuff online.

For list mail it varies. Lists that I post to or semi-officially archive get copied locally as backup. A couple of lists have so much traffic with a fairly low percentage of good content that I just leave them on the server. I don’t delete old messages for those because searches turn up the interesting bits without my having to manage things.

But it’s just as easy, to sort lists or whatever directly into ‘on my mac’ folders instead of mail server folders if you don’t need/want to read them when out and about.

Maybe the thing to do is to approach this slightly differently. You could create a Smart Mailbox with the same conditions as the Rule you made (sender is Washington Post or New York Times, and date received is more than 2 days old). Then every day or few days, go to the smart mailbox, select all, and press delete. A bit more manual than you’re looking for, but it at least makes it easy to quickly select all the old messages and delete.

In theory, you could script this using GUI scripting, but whether it’s worth the effort developing that script depends on how onerous it is for you to periodically clear out the smart mailbox. I realise this is a bit unsatisfying, as it would be great for it to be automated.

One last suggestion, is you could try posting the question in the AppleScript category on Late Night Software’s forums. Their Script Debugger is an excellent scripting app (with a free mode for basic usage), and their forum will have AppleScript experts on it that might be able to help.

1 Like

Mine is fully automated. I set it up about five years ago. It’s really pretty simple. I get a lot of daily newsletters from news sites, so: 1) I have a single Mail rule (if any is true) which contains the From address of each one, spots them as they come in, marks them purple and puts them directly into the Trash folder. 2) In Mail Preferences/Accounts/Mailbox Behaviors, my Trash folder is set to Erase Deleted Messages after one month, which could be set shorter. 3) I have a smart mailbox called “UNREAD” which is checked to Include messages from Trash.
Whenever I check email, it is from the UNREAD box not the Inbox, so I can see or read those newsletters or skip them. They are already in the Trash so they get deleted according to my Mailbox Behavior setting, whether read or not.
(I never look in Inbox except to periodically clean it out or on rare occasions when the billiard-ball numbers alongside the Inbox and the UNREAD box don’t match for some reason.)
That’s it. The only reason I have them marked purple is so I can read or quickly skip over them as I choose.

PS I also use Mail Rules to file email in individual subject folders I maintain, and use the MailHub add-on to enable me to click-file incoming or outgoing emails by subject in those cases where I haven’t bothered to create a rule.

1 Like

MailHub is amazing, and central to my use of Mail. I would probably look for another email client without it, highly recommended to others!

Hmm, maybe I’m missing something obvious, but it looks like your rule says “is equal to” “email@washington”. I think perhaps you want “contains” “email@washington”; email@washington is not the full address that you want to detect.