{"id":7045,"date":"2017-10-09T17:20:21","date_gmt":"2017-10-09T09:20:21","guid":{"rendered":"http:\/\/rmohan.com\/?p=7045"},"modified":"2017-10-09T17:21:14","modified_gmt":"2017-10-09T09:21:14","slug":"postfix-admin","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7045","title":{"rendered":"postfix admin"},"content":{"rendered":"<p>This article mainly describes the postfix common command and mail queue management:<\/p>\n<p>Postfix has the following four message queues, are managed by the management of the process of unified management:<\/p>\n<p>maildrop: local mail placed in maildrop, but also copied to incoming.<br \/>\nincoming: Places messages that are arriving at the queue or managing the process that have not yet been discovered.<br \/>\nactive: places the queue management process has been opened and is ready to deliver the message, the queue has a length limit.<br \/>\ndeferred: Place messages that can not be delivered. May be delayed sending mail<br \/>\nStart postfix<\/p>\n<p>\/usr\/sbin\/postfix start<br \/>\nStop postfix<\/p>\n<p>\/usr\/sbin\/postfix stop<br \/>\nCheck the postfix configuration file<\/p>\n<p>\/usr\/sbin\/postfix check<br \/>\nDisplays the configuration information that Postfix currently takes effect<\/p>\n<p>postconf -n<br \/>\nRe-read the postfix configuration file<\/p>\n<p>\/ usr \/ sbin \/ postfix reload<br \/>\nView messages in the queue:<\/p>\n<p>mailq<br \/>\npostqueue -p<br \/>\nView the queue size<\/p>\n<p>mailq | wc &#8211; l<br \/>\npostqueue -p | wc -l<br \/>\nView the contents of the message<\/p>\n<p>postcat -q Queue_ID<br \/>\nForce the sending of messages in the queue<\/p>\n<p>\/ usr \/ sbin \/ postfix flush<br \/>\npostqueue -f<br \/>\nSuspended sending messages in the queue<\/p>\n<p>postsuper &#8211; h Queue_ID<br \/>\npostsuper- h ALL deferred<br \/>\nUnblock sent messages<\/p>\n<p>postsuper &#8211; H Queue_ID<br \/>\npostsuper -H ALL deferred<br \/>\nRejoining the queue:<\/p>\n<p>postsuper &#8211; r Queue_ID<br \/>\npostsuper -r ALL<br \/>\nDelete the specified message<\/p>\n<p>postsuper -d Queue_ID<br \/>\nEmpty the messages in the queue<\/p>\n<p>postsuper -d ALL<br \/>\n# Delete the message in the queue (in the deferred list of messages, delete the mail file directly, you can see which letters were deleted):<\/p>\n<p>postsuper &#8211; d ALL deferred<br \/>\n find \/ var \/ spool \/ postfix \/ deferred -type f -exec rm &#8211; vf {} \\;<br \/>\n# find \/ var \/ spool \/ postfix \/ defer -type f -exec rm -vf {} \\;<br \/>\nList all problem mail (currently all messages that can not be sent)<\/p>\n<p>find \/ var \/ spool \/ postfix \/ deferred -type f -exec ls -l &#8211; time -style = +% Y-% m-% d_% H:% M:% S {} \\;<br \/>\nDelete messages that have not been sent for 3 days<\/p>\n<p>find \/ var \/ spool \/ postfix \/ deferred -type f -mtime + 3 -exec rm -f {} \\;<br \/>\nDelete bounce records for more than 5 days of mail (more than 5 days in the &#8220;defer&#8221; list)<\/p>\n<p>find \/var\/spool\/postfix\/defer -type f -mtime + 5 -exec rm -f {} \\;<\/p>\n<p># Here are some related logs<\/p>\n<p>View the system log:<\/p>\n<p>tail -f \/ var \/ log \/ messages<br \/>\nCheck the e-mail log: basically very comprehensive, almost all of the mail problems encountered can be handled by the log<\/p>\n<p>tail -f \/ var \/ log \/ maillog<br \/>\nmaildrop related<\/p>\n<p>tail -f \/var\/log\/maildrop.log<br \/>\nclamd related<\/p>\n<p>tail -f \/ var \/ log \/ clamav \/ clamd.log<br \/>\n tail -f \/var\/log\/clamav\/freshclam.log<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article mainly describes the postfix common command and mail queue management:<\/p>\n<p>Postfix has the following four message queues, are managed by the management of the process of unified management:<\/p>\n<p>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 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7045"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7045"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7045\/revisions"}],"predecessor-version":[{"id":7047,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7045\/revisions\/7047"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}