× Post Fix is a great tool that comes usually bundled with vps servers and handles the mailboxes.

Postfix Mail Queue Management

Περισσότερα
3 Χρόνια 4 Μήνες πριν #121 από infogate
Postfix Mail Queue Management δημιουργήθηκε από infogate
Postfix Mail System is the one of the most widely used mail systems along with Exim. In the initial days postfix was widely used for custom setup and custom Mail server setups. But nowadays Plesk servers also has Postfix as the default mail server and not Qmail. In this blog, we mainly concentrate on Mail Queue Management commands which almost all server owners and server administrator may need at some point of time.
Postfix has five different queues and they are listed below. All mails which postfix handles will stay in the server in one of these queues until the message leaves from the server.

maildrop
hold
incoming
active
deferred
Corrupt
You can get a detailed reference of all the above queues from this link. Postfix uses a separate directory for each of the above queues and the default directory for those are:
/var/spool/postfix/maildrop
/var/spool/postfix/hold
/var/spool/postfix/incoming
/var/spool/postfix/active
/var/spool/postfix/deferred
/var/spool/postfix/corrupt

The above is just a reference for the queue structure and below is the actual set of commands which a server owner or a server administrator needs to handle a Postfix Mail queue and I will also mention how to find out a spamming instance as well so that you can get a more detailed idea on postfix queue management.

Display the list of Queued mails , deferred mails, and Pending mails

# postqueue -p
Sample Output
[root@host1 ~]# postqueue  -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
C79CEC3F6BC*     526 Wed Dec  5 15:05:18  root@host1.server.com
test.test@gmail.com

In the above result, Queue ID is C79CEC3F6BC and we need this for all future checks


To Display the mail header and contents
# postcat -q “Queue ID”
# postcat -q C79CEC3F6BC

To check the total number of mails in the queue
# postqueue -p | grep -c "^[A-Z0-9]"

To reattempt delivery of all mails in the queue
# postqueue -f

To remove all Mails in the Queue
# postsuper -d ALL

To remove all mails in the deferred Queue
# postsuper -d ALL deferred

To remove particular mail in the queue.
# postsuper -d “Queue ID”
# postsuper -d C79CEC3F6BC

To remove all mails from a particular mail id
Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από τους αυτοματισμούς αποστολέων ανεπιθύμητων μηνυμάτων. Χρειάζεται να ενεργοποιήσετε τη JavaScript για να μπορέσετε να τη δείτε.
# mailq | tail +2 | awk 'BEGIN { RS = "" } / test.test@domain\.com$/ { print $1 }' |
tr -d '*!' | postsuper -d -


To attempt to send one particular mail
# postqueue -i “Queue ID”
# postqueue -I C79CEC3F6BC


To clear the infected mails by user or pattern
To clear the infected mails sent by a specific user or any specific pattern, you can use the below one. This will simply check that content which is searching and will remove all those emails which contains that pattern.

To remove all mails which have Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από τους αυτοματισμούς αποστολέων ανεπιθύμητων μηνυμάτων. Χρειάζεται να ενεργοποιήσετε τη JavaScript για να μπορέσετε να τη δείτε. in the entire mail.
# for id in `postqueue -p|grep '^[A-Z0-9]'|cut -f1 -d' '|sed 's/*//g'`; do postcat -q $id
| grep test.test@domain.com  && postsuper -d $id; done

To remove all mails which have a particular pattern like “X-PHP-Originating-Script: 48:badmailing.php” we can use the above script as below. When you are giving a longer pattern, make sure you copy paste all space and give all those exactly in the double quotes.
# for id in `postqueue -p|grep '^[A-Z0-9]'|cut -f1 -d' '|sed 's/*//g'`;
do postcat -q $id | grep “X-PHP-Originating-Script: 48:badmailing.php”
&& postsuper -d $id; done

Conclusion
I hope this article helps you get more comfortable with Postfix Mail Queue Management.


The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal

Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.

Χρόνος δημιουργίας σελίδας: 0.212 δευτερόλεπτα
Powered by Kunena Φόρουμ