April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

postfix admin

This article mainly describes the postfix common command and mail queue management:

Postfix has the following four message queues, are managed by the management of the process of unified management:

maildrop: local mail placed in maildrop, but also copied to incoming.
incoming: Places messages that are arriving at the queue or managing the process that have not yet been discovered.
active: places the queue management process has been opened and is ready to deliver the message, the queue has a length limit.
deferred: Place messages that can not be delivered. May be delayed sending mail
Start postfix

/usr/sbin/postfix start
Stop postfix

/usr/sbin/postfix stop
Check the postfix configuration file

/usr/sbin/postfix check
Displays the configuration information that Postfix currently takes effect

postconf -n
Re-read the postfix configuration file

/ usr / sbin / postfix reload
View messages in the queue:

mailq
postqueue -p
View the queue size

mailq | wc – l
postqueue -p | wc -l
View the contents of the message

postcat -q Queue_ID
Force the sending of messages in the queue

/ usr / sbin / postfix flush
postqueue -f
Suspended sending messages in the queue

postsuper – h Queue_ID
postsuper- h ALL deferred
Unblock sent messages

postsuper – H Queue_ID
postsuper -H ALL deferred
Rejoining the queue:

postsuper – r Queue_ID
postsuper -r ALL
Delete the specified message

postsuper -d Queue_ID
Empty the messages in the queue

postsuper -d ALL
# Delete the message in the queue (in the deferred list of messages, delete the mail file directly, you can see which letters were deleted):

postsuper – d ALL deferred
find / var / spool / postfix / deferred -type f -exec rm – vf {} \;
# find / var / spool / postfix / defer -type f -exec rm -vf {} \;
List all problem mail (currently all messages that can not be sent)

find / var / spool / postfix / deferred -type f -exec ls -l – time -style = +% Y-% m-% d_% H:% M:% S {} \;
Delete messages that have not been sent for 3 days

find / var / spool / postfix / deferred -type f -mtime + 3 -exec rm -f {} \;
Delete bounce records for more than 5 days of mail (more than 5 days in the “defer” list)

find /var/spool/postfix/defer -type f -mtime + 5 -exec rm -f {} \;

# Here are some related logs

View the system log:

tail -f / var / log / messages
Check the e-mail log: basically very comprehensive, almost all of the mail problems encountered can be handled by the log

tail -f / var / log / maillog
maildrop related

tail -f /var/log/maildrop.log
clamd related

tail -f / var / log / clamav / clamd.log
tail -f /var/log/clamav/freshclam.log

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>