You know how when a meltdown happens and you get tens of thousands of automated emails telling you about it? And then Mail.app cringes as you try to select them all and delete them? No? Then we do different work.
But if it ever does happen to you, you can use this python code snippit to connect directly to your mail server and delete them. I usually just paste this kind of thing right into the python interpreter.
(FROM \"email@example.com\") part is the selection criterion in this example, but there are more to choose from!
import imaplib from getpass import getpass imap = imaplib.IMAP4_SSL('mail.example.com') imap.login('luke',getpass()) imap.select() typ, data = imap.search(None, '(FROM \"firstname.lastname@example.org\")') for num in data.split(): imap.store(num, '+FLAGS', '\\Deleted') imap.expunge() imap.close() imap.logout()