{"id":28,"date":"2006-09-20T13:45:13","date_gmt":"2006-09-20T13:45:13","guid":{"rendered":"http:\/\/ramblingsofasysadmin.com\/blog\/?p=28"},"modified":"2006-09-20T13:45:13","modified_gmt":"2006-09-20T13:45:13","slug":"qmail-7-day-mail-queues-too-long","status":"publish","type":"post","link":"https:\/\/ramblingsofasysadmin.com\/?p=28","title":{"rendered":"qmail: 7 day mail queues?  too long."},"content":{"rendered":"<p>i&#8217;ve been taking a proactive stance in checking the mail queue in my office, since if it gets cluttered with newsletters or unnecessary stuff (including the occasional password phishing from code vulnerabilities in contact forms), it ends up slowing down other emails significantly.<br \/>\nby default, the qmail queue is 7 days long (604800 seconds).  to check that, you can run the following:<br \/>\n<font face=\"courier\"># qmail-showctl | grep queue<br \/>\nqueuelifetime: (Default.) Message lifetime in the queue is 604800 seconds.<\/font><br \/>\n(side point: there&#8217;s a lot of cool stuff you can see there related to the qmail setup if you don&#8217;t only grep for the queue.)<br \/>\nin my opinion, 7 days is just way too long.  sometimes i&#8217;m checking the queue and an email is mailed to a wrong address&#8230; and the email just sits there while the mailserver repeatedly attempts to send the message to this nonexistent address.  (for example, if you&#8217;re looking to email someguy@aol.com and you accidentally addressed it with the domain aol.org, you&#8217;ll be waiting a long time for a bounceback, which might cause frustration and anger because you thought you sent it to the right guy to begin with.)<br \/>\neverything on linux can be tweaked, and it&#8217;s relatively easy to do at times.  in this particular case, what is needed is a newly created file, <font face=\"courier\">\/var\/qmail\/control\/queuelifetime<\/font>, which contains a single line: the number of seconds that you want the queue to last.  in my case, i made it 172800 seconds (2 full days; a single day is 86400), so these emails get returned to sender informing them that they should get the right address or try later.<br \/>\nonce you run this file, you can verify that the new queue length is in effect by running the following:<br \/>\n<font face=\"courier\"># \/var\/qmail\/bin\/qmail-showctl | grep queue<br \/>\nqueuelifetime: Message lifetime in the queue is 172800 seconds.<\/font><br \/>\nnote how it doesn&#8217;t say &#8220;Default&#8221; anymore like the previous execution of the same command did.<br \/>\nto force those old emails to be sent?  just run <font face=\"courier\">qmHandle -a<\/font> and you&#8217;ll notice that the queue (<font face=\"courier\">qmHandle -l<\/font>) has gotten a lot shorter.<br \/>\nif you don&#8217;t have <font face=\"courier\">qmHandle<\/font>, <a href=\"http:\/\/sourceforge.net\/projects\/qmhandle\" target=\"_new\">you can get it on sourceforge; just click here<\/a>.  it&#8217;s not part of the regular qmail distribution.  more information on qmHandle can be found in <a href=\"http:\/\/www.ramblingsofasysadmin.com\/2006\/06\/viewing_mail_queues.html\" target=\"_new\">this blog entry<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>i&#8217;ve been taking a proactive stance in checking the mail queue in my office, since if it gets cluttered with newsletters or unnecessary stuff (including the occasional password phishing from code vulnerabilities in contact forms), it ends up slowing down other emails significantly. by default, the qmail queue is 7 days long (604800 seconds). to check that, you can run the following: # qmail-showctl | grep queue queuelifetime: (Default.) Message lifetime in the queue is <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/ramblingsofasysadmin.com\/?p=28\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=28"}],"version-history":[{"count":0,"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramblingsofasysadmin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}