Professional Documents
Culture Documents
5 Top Tips For Reviewing Your Postfix Mail Queue - Wirehive
5 Top Tips For Reviewing Your Postfix Mail Queue - Wirehive
☰ NAVIGAT ION
JON TOTHAM
SENIOR SYSTEMS ADMINISTRATOR
WIREHIVE
SHARE
THOUGHTS
There are two queues within Postfix: pending and differed. The pending queue
includes all messages that have been submitted to postfix which have not yet Privacidad - Condiciones
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/ 1/6
21-06-2019 5 top tips for reviewing your Postfix mail queue | Wirehive
been sent out and handed off to the recipient server. The differed mail queue
holds all messages that have soft-failed and☰ need
NAVIGAT ION
to be retired (temporary
failure). Postfix will retry sending the deferred queue on set intervals (this is
configurable, but is set to 5 minutes as a default).
mailq
or
postqueue -p
or
NB: this command shows the sender and recipients and ID, not the message
itself. The ID is particularly useful if you want to inspect the message itself.
Or to save it in a file
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/ 2/6
21-06-2019 5 top tips for reviewing your Postfix mail queue | Wirehive
X-PHP-Originating-Script: 1001:spamEmailer.php
☰ NAVIGAT ION
In this example 1001 is the UID and the spamEmailer.php was the script sending
the message. This can allow you to quickly track down the source of spam
messages being sent by your server.
With these commands you should be able to review your mail queue and make
sure that intended messages are being sent and have not been rejected.
Now that we have learned the necessary steps to reviewing your mail queue, the
final 3 tips will demonstrate how to delete queued mail.
postqueue -f
OR
postfix flush
This will cause Postfix to immediately attempt to send all queued messages.
postsuper -d ALL
Delete only the differed mail queue messages (i.e. only the ones the system
intends to retry later)
This is not something that is natively included with the standard Postfix tools
however can be done with a bit of Perl scripting.
NB: This perl script seems to be free, and is all over the internet however I could
not find out where it originates or who wrote it but my thanks go to them!
#########################################
Privacidad - Condiciones
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/ 3/6
21-06-2019 5 top tips for reviewing your Postfix mail queue | Wirehive
#!/usr/bin/perl
☰ NAVIGAT ION
@data = qx;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
}
if($queue_id) {
if (/$REGEXP/i) {
$Q{$queue_id} = 1;
}
}
};
close(POSTSUPER);
#########################################
Usage Examples:
Delete all queued messages to or from the domain called spamers.com, enter: Privacidad - Condiciones
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/ 4/6
21-06-2019 5 top tips for reviewing your Postfix mail queue | Wirehive
./postfix-delete.pl spamers.com
☰ NAVIGAT ION
Delete all queued messages that contain the word “spam” in the e-mail address:
./postfix-delete.pl spam
If you’re having trouble with your mail server, and this hasn’t helped you fix things
why not give us a call?
SIMILAR POSTS
1 8.02.19
Using Amazon Web Services Applications to run your Business
When Amazon Web Services (AWS) is mentioned, you likely think of cloud based
services such as autoscaling websites, multi-regional support and other more
well known things. However there are a whole range of Amazon Web Services
applications that you may not have come across. Those services relating to
business productivity.
Privacidad - Condiciones
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/ 5/6
21-06-2019 5 top tips for reviewing your Postfix mail queue | Wirehive
☰ NAVIGAT ION
30.1 1.18
Understanding Cloud Services – Stateful vs Stateless Applications
To be able to make the most of the services available within public cloud hosting
it is necessary to create a stateless application.
In this article we look at the difference between stateful and stateless, and why it
matters.
Privacidad - Condiciones
https://www.wirehive.com/thoughts/5-top-tips-reviewing-postfix-mail-queue/ 6/6