Postfix is a free and open-source mail transfer agent (MTA) that routes and delivers an email. Under Postfix MTA, there are basic command to empty or remove Postfix Mail Queue. In the case of the postfix MTA server suddenly offline or postfix service not respond, all the mail will be in queued. To avoid the messages sent out when it reconnected to the internet, you have an option to empty the mail queue. In this post, i will show how to remove the Postfix Mail Queue using postsuper command.
1. Send an email using telnet command :
[[email protected] ~]# telnet localhost 25 Trying ::1... Connected to localhost. Escape character is '^]'. 220 centos63.ehowstuff.local ESMTP Postfix helo abc.com 250 centos63.ehowstuff.local mail from:
250 2.1.0 Ok rcpt to: 250 2.1.5 Ok data 354 End data with . subject: Test . 250 2.0.0 Ok: queued as DB92A1231 quit 221 2.0.0 Bye Connection closed by foreign host.
2. To see mail queue, enter the following :
[[email protected] ~]# mailq -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- DB92A1231* 359 Tue Feb 5 22:14:01 [email protected] [email protected] -- 0 Kbytes in 1 Request.
3. Check mail transaction log :
[[email protected] ~]# grep DB92A1231 /var/log/maillog 2013-02-05T22:14:14.899894+08:00 centos63 postfix/smtpd: DB92A1231: client=localhost[::1] 2013-02-05T22:14:23.843262+08:00 centos63 postfix/cleanup: DB92A1231: message-id=<[email protected]> 2013-02-05T22:14:23.946379+08:00 centos63 postfix/qmgr: DB92A1231: from=
, size=359, nrcpt=1 (queue active) 2013-02-05T22:14:55.526423+08:00 centos63 postfix/smtp: DB92A1231: to= , relay=none, delay=54, delays=22/0.02/32/0, dsn=4.4.1, status=deferred (connect to ehowstuff.com[220.127.116.11]:25: Connection timed out)
4. To remove all mails in the deferred queue, enter the following :
[[email protected] ~]# postsuper -d ALL deferred postsuper: Deleted: 1 message
5. To remove all mail from the queue, enter the following :
[[email protected] ~]# postsuper -d ALL
Like this Article? Subscribe to Our Feed!
This article was posted on Tuesday, February 5, 2013 at 11:17 PM