Monday, April 27, 2015

Check postfix email queue, and how to clear emails in there

To check the queue, we use a command called mailq, example as below:

$ mailq | tail

2024F98A61     3505 Mon Apr 27 18:16:17  support.us@something.com
(delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.something.com type=AAAA: Host not found)
                                         support.us@somethingelse.com
231EC98AED     3525 Fri Apr 24 16:48:04  support.us@something.com
(delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.something.com type=AAAA: Host not found)
                                         whoami@somethingelse.com

To clear the email in the queue, a command called postsuper is used, as below:

$ sudo postsuper -d ALL

To check the status of deletion, you can refer to the maillog, in below example, 15 messages have been deleted:

$ sudo tail /var/log/maillog

Apr 27 19:44:02 au-mel-rh-dev-3 postfix/smtp[6927]: 46F5598AF7: to=, relay=mta5.am0.yahoodns.net[98.138.112.37]:25, delay=2568, delays=2562/0.02/4.3/2, dsn=2.0.0, status=sent (250 ok dirdel)
Apr 27 19:44:02 au-mel-rh-dev-3 postfix/qmgr[5985]: 46F5598AF7: removed
Apr 27 19:44:04 au-mel-rh-dev-3 postfix/smtp[6925]: ABA8B98AFA: to=, relay=mta5.am0.yahoodns.net[98.138.112.34]:25, delay=1624, delays=1617/0.02/4.4/3.3, dsn=2.0.0, status=sent (250 ok dirdel)
Apr 27 19:44:04 au-mel-rh-dev-3 postfix/qmgr[5985]: ABA8B98AFA: removed
Apr 27 19:49:27 au-mel-rh-dev-3 postfix/postsuper[7913]: Deleted: 15 messages



No comments: