{"id":1469,"date":"2018-01-05T18:27:25","date_gmt":"2018-01-05T15:27:25","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=1469"},"modified":"2023-08-19T03:04:47","modified_gmt":"2023-08-19T00:04:47","slug":"postfix-administration-commands-cheat-sheet","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/postfix-administration-commands-cheat-sheet\/","title":{"rendered":"Postfix Commands Administration Cheat Sheet"},"content":{"rendered":"\n<p>Hello good people, here is a Postfix Commands Administration Cheat Sheet I made as a quick reference when administering Postfix. It contains most used postfix commands for troubleshooting problems. Postfix is one of the most popular open-source email relay servers out there, exim coming close to it.<\/p>\n\n\n\n<p>Recently I covered:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/computingforgeeks.com\/installing-postfix3-on-centos-7\/\" target=\"_blank\" rel=\"noreferrer noopener\">Installing postfix3 on CentOS 7<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/install-cbpolicyd-on-centos-7\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install cbpolicyd On CentOS 7<\/a><\/li>\n<\/ul>\n\n\n\n<p>Postfix&nbsp;checking email queues.<\/p>\n\n\n\n<p>To check current active&nbsp; mail queue, use the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$&nbsp;mailq<\/code><\/pre>\n\n\n\n<p>Get email accounts with high Postfix queues<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$&nbsp;mailq|grep ^&#91;A-F0-9]|cut -c 42-80|sort |uniq -c|sort -n|tail<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Using Postfix postsuper command<\/h3>\n\n\n\n<p>postsuper is&nbsp;Postfix superintendent. This is command does maintenance jobs on the Postfix queue. Use of the postsuper command is restricted to the superuser of the <a href=\"https:\/\/computingforgeeks.com\/how-to-setup-mail-server-on-centos\/\">Mail server<\/a>.&nbsp;By default, postsuper performs the operations requested with the <strong>-s<\/strong>, and <strong>-p<\/strong> command-line options on all Postfix queue directories &#8211; this includes the incoming, active and deferred directories with mail files and the bounce, defer, trace and flush directories with log files.<\/p>\n\n\n\n<p><strong>Command options:<\/strong><\/p>\n\n\n\n<p><strong>-d queue_id<\/strong> &#8211;&gt;&nbsp; Delete one message with the named queue ID from the named mail queue(s)<br>(default: hold, incoming, active and deferred).<\/p>\n\n\n\n<p><strong>-h queue_id<\/strong> &#8212; &gt; Put mail &#8220;on hold&#8221; so that no attempt is made to deliver it. Move one message<br>with the named queue ID from the named mail queue(s) &#8211; (default: <strong>incoming, active and deferred<\/strong>) to the hold queue.<\/p>\n\n\n\n<p><strong>-H queue_id<\/strong> &#8211;&gt; Release mail that was put &#8220;on hold&#8221;. Move one message with the named queue ID<br>from the named mail queue(s) &#8211; (default: <strong>hold<\/strong>) to the deferred queue.<\/p>\n\n\n\n<p><strong>-r queue_id<\/strong> &#8211;&gt; Requeue the message with the named queue ID from the named mail queue(s)- (default<strong>: hold, incoming, active and deferred<\/strong>).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Examples:<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\">Postfix hold all deferred messages<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># postsuper -h ALL deferred<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Postfix remove all messages on hold<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># postsuper -d ALL hold<\/code><\/pre>\n\n\n\n<p>This releases all mail that was put <strong>&#8220;on hold&#8221;<\/strong><\/p>\n\n\n\n<p>Beside&nbsp;<strong>hold,&nbsp;<\/strong>you can do same for&nbsp;<strong>incoming<\/strong>, <strong>active<\/strong> and <strong>deferred.<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Postfix release all messages on HOLD.<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># postsuper -H ALL<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Postfix dump all mails back to queue (Requeue)<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># postsuper -r ALL<\/code><\/pre>\n\n\n\n<p>(default: hold, incoming, active and deferred)<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Postfix purge old temporary files<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># postsuper -p<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Using Postfix&nbsp;postqueue command.<\/h3>\n\n\n\n<p><strong>postqueue<\/strong> &#8211; This is a Postfix queue control tool.&nbsp;The postqueue command implements the Postfix user interface for queue management. It implements operations that are traditionally available via the sendmail command. postqueue command options:<\/p>\n\n\n\n<p><strong>-f<\/strong>&nbsp; &#8211;&gt; Flush the queue: attempt to deliver all queued mail.<\/p>\n\n\n\n<p><strong>-i queue_id<\/strong> &#8211;&gt; Schedule immediate delivery of deferred mail with the specified queue ID.<\/p>\n\n\n\n<p><strong>-j&nbsp;<\/strong> &#8211;&gt; Produce a queue listing in JSON format, based on the output from the <strong>showq<\/strong> daemon<\/p>\n\n\n\n<p><strong>-p<\/strong> &#8211;&gt; Produce a traditional sendmail-style queue listing. This option implements<br>the traditional mailq command, by contacting the Postfix <strong>showq<\/strong>&nbsp;daemon.The queue ID string is followed by an optional status character:<\/p>\n\n\n\n<p><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<\/strong>&nbsp; &#8211;&gt; The message is in the active queue, i.e. the message is selected for delivery.<\/p>\n\n\n\n<p><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; !&nbsp;<\/strong> &#8211;&gt; The message is in the hold queue, i.e. no further delivery attempt will be made until the mail is taken off hold.<\/p>\n\n\n\n<p>Examples:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Flushing queue with postqueue:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>$&nbsp;postqueue -f<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Print&nbsp; postfix queue in&nbsp;sendmail-style:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>$&nbsp;postqueue -p<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Postfix print queue in JSON format<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>$&nbsp;postqueue -j<\/code><\/pre>\n\n\n\n<p>Have fun using\u00a0Postfix Commands Administration Cheat Sheet, drop comments for any commands you often use when working with Postfix Relay servers. I&#8217;ll be happy to update this list with any new item.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello good people, here is a Postfix Commands Administration Cheat Sheet I made as a quick reference when administering Postfix. It contains most used postfix commands for troubleshooting problems. Postfix is one of the most popular open-source email relay servers out there, exim coming close to it. Recently I covered: Postfix&nbsp;checking email queues. To check &#8230; <a title=\"Postfix Commands Administration Cheat Sheet\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/postfix-administration-commands-cheat-sheet\/\" aria-label=\"Read more about Postfix Commands Administration Cheat Sheet\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":1487,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[330,12,17,328,29,50,139,73,81],"tags":[289,173,287,288],"class_list":["post-1469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cheat-sheets","category-arch-linux","category-centos","category-email","category-fedora","category-linux-tutorials","category-postfix","category-rhel","category-ubuntu","tag-mailq","tag-postfix","tag-postqueue","tag-postsuper"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/1469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=1469"}],"version-history":[{"count":0,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/1469\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/1487"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=1469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=1469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=1469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}