One of my friends email account was hacked, and was used to send tons of spam mails. Some of the mails were sent direct from his account while some others where spoofed. There were around 50K emails in the queue.
I cleared all mails sent from him with the following command.
where email@example.com is the account that was hacked.
Still there were close to 49000 mails in the queue. I wrote the following script to clear them. It basically checked the auth_id field in the header section of every email in the queue and if it matches firstname.lastname@example.org, then delete the message from the queue.Read More