{"id":892,"date":"2018-10-22T10:47:57","date_gmt":"2018-10-22T10:47:57","guid":{"rendered":"http:\/\/orissawebhosting.in\/blog\/?p=892"},"modified":"2019-06-27T13:59:22","modified_gmt":"2019-06-27T13:59:22","slug":"inspecting-server-email-queue","status":"publish","type":"post","link":"https:\/\/orissawebhosting.in\/blog\/inspecting-server-email-queue\/","title":{"rendered":"How to Survey my server email queue in VPS"},"content":{"rendered":"<h4>How to view messages in the postfix queue<\/h4>\n<p>1- Postfix maintains two queues, the pending mails queue, and the deferred mail queue,\u00a0the deferred mail queue has the mail that has soft-fail and should be retried (Temporary failure), Postfix retries the deferred queue on set intervals (configurable, and by default 5 minutes).<\/p>\n<h4>1- Display a list of queued mail, deferred and pending<\/h4>\n<pre>mailq or postqueue -p<\/pre>\n<p>To save the output to a text file you can run.<\/p>\n<pre>mailq &gt; myfile.txt  or postqueue -p &gt; myfile.txt<\/pre>\n<p>The above commands display all queued messages (Not the message itself but the sender and recipients and ID), The ID is particularly useful if you want to inspect the message itself.<\/p>\n<h4>2- View message (contents, header and body) in Postfix queue<\/h4>\n<p>Assuming the message has the ID XXXXXXX (you can see the ID form the QUEUE)<\/p>\n<pre>postcat -vq XXXXXXXXXX<\/pre>\n<p>Or to save it in a file<\/p>\n<pre>postcat -vq XXXXXXXXXX &gt; themessage.txt<\/pre>\n<h4>3- Tell Postfix to process the Queue now<\/h4>\n<pre>postqueue -f   or postfix flush<\/pre>\n<h4>4- Delete queued mail<\/h4>\n<pre>postsuper -d ALL<\/pre>\n<p>Delete differed mail queue messages<\/p>\n<p>(The ones the system intends to retry later)<\/p>\n<pre>postsuper -d ALL deferred<\/pre>\n<p>Delete from queue selectively<\/p>\n<p>To delete from the queue all emails that have a certain address in them, we can use this program (perl script)\u2026<\/p>\n<p>NOTE: This perl script seems to be free, and is all over the internet, i could not find out where it originates or who wrote it.<\/p>\n<p>Delete all queued messages to or from the domain called example.com,<\/p>\n<pre>\/postfix-delete.pl example.com<\/pre>\n<p>Delete all queued messages that contain the word \u201cspam\u201d in the e-mail address:<\/p>\n<pre>.\/postfix-delete.pl spam<\/pre>\n<p>Now you know how to manage mails in server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to view messages in the postfix queue 1- Postfix maintains two queues, the pending mails queue, and the deferred mail queue,\u00a0the deferred mail queue has the mail that has soft-fail and should be retried (Temporary failure), Postfix retries the deferred queue on set intervals (configurable, and by default 5 minutes). 1- Display a list of queued mail, deferred and pending mailq or postqueue -p To save the output to a text file you can run. mailq &gt; myfile.txt or postqueue -p &gt; myfile.txt The above commands display all queued&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/892"}],"collection":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=892"}],"version-history":[{"count":10,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/892\/revisions"}],"predecessor-version":[{"id":1056,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/892\/revisions\/1056"}],"wp:attachment":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}