{"id":5229,"date":"2015-10-04T13:25:20","date_gmt":"2015-10-04T05:25:20","guid":{"rendered":"http:\/\/rmohan.com\/?p=5229"},"modified":"2015-10-04T13:25:20","modified_gmt":"2015-10-04T05:25:20","slug":"postfix-useful-commands","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5229","title":{"rendered":"Postfix Useful Commands"},"content":{"rendered":"<p>To Check Postfix Queue<br \/>\n#mailq<\/p>\n<p>To Check Sasl Auth<br \/>\n#tail -f \/var\/log\/messages|grep sasl<\/p>\n<p>To Check Posfix Logs<br \/>\n#tail -f \/var\/log\/maillog|grep postfix<\/p>\n<p>List of domains that are being deferred<br \/>\n#qshape-maia -s  deferred<\/p>\n<p>Checking Specific Mail From Queue<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nTo view the full mails<br \/>\n#postcat -q D5EB71AEA45<br \/>\nIf you an error postcat: fatal: open queue file D5EB71AEA45: No such file or directory, Then it means mail has been delivered or removed using postsuper<\/p>\n<p>If you want to remove specific mail from queue<br \/>\n#postsuper -d  D5EB71AEA45<\/p>\n<p>Sorting Queued Mails By From Address:<br \/>\n# mailq | awk &#8216;\/^[0-9,A-F]\/ {print $7}&#8217; | sort | uniq -c | sort -n<\/p>\n<p>Removing Mails Based On Sender Address<br \/>\n# mailq| grep &#8216;^[A-Z0-9]&#8217;|grep peggysj@msn.com|cut -f1 -d&#8217; &#8216; |tr -d \\*|postsuper -d &#8211;<\/p>\n<p>or, if you have put the queue on hold, use<br \/>\n# mailq | awk &#8216;\/^[0-9,A-F].*capitalone@mailade.com\/ {print $1}&#8217; | cut -d &#8216;!&#8217; -f 1 | postsuper -d &#8211;<br \/>\nto remove all mails being sent using the From address \u201ccapitalone@mailade.com\u201d.<\/p>\n<p>if you want to remove all mails sent by the domain msn.com from the queue<br \/>\n#mailq| grep &#8216;^[A-Z0-9]&#8217;|grep @msn.com|cut -f1 -d&#8217; &#8216; |tr -d \\*|postsuper -d &#8211;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To Check Postfix Queue #mailq<\/p>\n<p>To Check Sasl Auth #tail -f \/var\/log\/messages|grep sasl<\/p>\n<p>To Check Posfix Logs #tail -f \/var\/log\/maillog|grep postfix<\/p>\n<p>List of domains that are being deferred #qshape-maia -s deferred<\/p>\n<p>Checking Specific Mail From Queue &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; To view the full mails #postcat -q D5EB71AEA45 If you an error postcat: fatal: open queue file D5EB71AEA45: [&#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\/5229"}],"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=5229"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5229\/revisions"}],"predecessor-version":[{"id":5230,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5229\/revisions\/5230"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}