How to clear deferred messages from Postfix Queue

O que ando aprendendo nesta caminhada sobre a Terra

How to clear deferred messages from Postfix Queue

Today I was watching the log file from Postfix (in CentOS 6.X default is /var/log/maillog) and saw a lot of messages being deferred.

Jan 5 15:02:03 vps3 postfix/smtp[27441]: 3187E2180015: to=<undesired@domain.com>, relay=domain.com[167.114.XXX.XXX]:25, delay=254553, delays=254538/0.2/15/0, dsn=
4.4.2, status=deferred (conversation with domain.com[167.114.XXX.XXX] timed out while receiving the initial server greeting)
Jan 5 15:02:03 vps3 postfix/smtp[27442]: CDED02180014: to=<undesired@domain.com.br>, relay=domain.com[167.114.XXX.XXX]:25, delay=258753, delays=258738/0.13/15/0, dsn
=4.4.2, status=deferred (conversation with domain.com[167.114.XXX.XXX] timed out while receiving the initial server greeting)
Jan 5 15:02:03 vps3 postfix/smtp[27443]: C8EE72180012: to=<undesired@domain.com.br>, relay=domain.com[167.114.XXX.XXX]:25, delay=258753, delays=258738/0.14/15/0, dsn
=4.4.2, status=deferred (conversation with domain.com[167.114.XXX.XXX] timed out while receiving the initial server greeting)
Jan 5 15:02:03 vps3 postfix/smtp[27444]: CDCE32180013: to=<undesired@domain.com.br>, relay=domain.com[167.114.XXX.XXX]:25, delay=258753, delays=258738/0.15/15/0, dsn
=4.4.2, status=deferred (conversation with domain.com[167.114.XXX.XXX] timed out while receiving the initial server greeting)

and these messages did repeat from time to time.

This was because I was setting up the mail server to relay messages from a specific account to a Gmail account and some messages that should have been blocked were eventually delivered. When finally finished reconfiguring all, Postfix could no longer deliver these messages because of a domain check rule the sender and always marked this message as deferred.
Here, the message is the least important thing. What I needed was for these lines vanished from logs.
So here’s a tip to get clean prey message queues and that goes for any reason.

To see what do you have in your mail queue type:

# mailq

or

# postqueue -p

You see results like that:

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
2CFD22180017 6361 Mon Jan 4 16:27:13 root@as8.producoesvsrevolucao.com.br
(host alt1.gmail-smtp-in.l.google.com[64.233.190.27] said: 421-4.7.0 [192.99.43.88 15] Our system has detected an unusual rate of 421-4.7.0 unsolicited mail originating from your IP address. To protect our 421-4.7.0 users from spam, mail sent from your IP address has been temporarily 421-4.7.0 rate limited. Please visit 421-4.7.0 https://support.google.com/mail/answer/81126 to review our Bulk Email 421 4.7.0 Senders Guidelines. 66si4725003qhp.11 - gsmtp (in reply to end of DATA command))
xxxnononoxxx@gmail.com

AB6302180016 1062 Sat Jan 2 17:43:22 advertise.bz222yiaku@gmail.com
(host alt1.gmail-smtp-in.l.google.com[64.233.190.27] said: 421-4.7.0 [192.99.43.88 15] Our system has detected an unusual rate of 421-4.7.0 unsolicited mail originating from your IP address. To protect our 421-4.7.0 users from spam, mail sent from your IP address has been temporarily 421-4.7.0 rate limited. Please visit 421-4.7.0 https://support.google.com/mail/answer/81126 to review our Bulk Email 421 4.7.0 Senders Guidelines. j133si42716128qhj.106 - gsmtp (in reply to end of DATA command))
xxxnononoxxx@gmail.com

849F02180010 3677 Thu Dec 31 20:22:07 gtve5x@gmail.com
(host alt1.gmail-smtp-in.l.google.com[64.233.190.27] said: 421-4.7.0 [192.99.43.88 15] Our system has detected an unusual rate of 421-4.7.0 unsolicited mail originating from your IP address. To protect our 421-4.7.0 users from spam, mail sent from your IP address has been temporarily 421-4.7.0 rate limited. Please visit 421-4.7.0 https://support.google.com/mail/answer/81126 to review our Bulk Email 421 4.7.0 Senders Guidelines. g70si65400626qkh.92 - gsmtp (in reply to end of DATA command))
xxxnononoxxx@gmail.com

-- 12 Kbytes in 3 Requests.

Every line is a message in queue. The first block is the Queue Id.

To remove one message from Queue type:

# postsuper -d AB6302180016
postsuper: AB6302180016: removed
postsuper: Deleted: 1 message

This will delete the message 849F02180010 from Queue.

Other useful commands:

# postfix flush

or

# postfix -f

Flush all messages from Postfix Queue.

# postsuper -d ALL

Remove all messages from queue.

# postsuper -d ALL deferred

Remove all deferred messages from queue.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.