{"id":752,"date":"2014-10-08T04:24:08","date_gmt":"2014-10-08T04:24:08","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=752"},"modified":"2014-10-08T04:24:08","modified_gmt":"2014-10-08T04:24:08","slug":"qmail-removing-emails-queue-specified-subject","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/10\/08\/qmail-removing-emails-queue-specified-subject\/","title":{"rendered":"Qmail : Removing emails from queue having the specified Subject"},"content":{"rendered":"<p>Identify the email header id from the queued emails.. I\u2019m goingg to use \u201cqmail-qstat\u201d command to know the email header. ID will starts with # symbal eg. #1445826<br \/>\n [root@mail4 ~]# \/var\/qmail\/bin\/qmail-qread  | more<br \/>\n4 Dec 2012 17:04:33 GMT  #1442054  7146  <bouncebacks@mallnetglobal.com><br \/>\n        remote  admin@sample.com<br \/>\n4 Dec 2012 17:06:16 GMT  #1442974  7048  <bouncebacks@mallnetglobal.com><br \/>\n        remote  admin@samplesouth.net<br \/>\n4 Dec 2012 17:08:47 GMT  #1444078  7064  <bouncebacks@mallnetglobal.com><br \/>\n        remote  admin@sampleotmail.com<\/p>\n<p>b. Find the messages associated with this email header.<br \/>\n [root@mail4 ~]# find \/var\/qmail\/queue -iname 1445826<br \/>\n\/var\/qmail\/queue\/mess\/0\/1445826<br \/>\n\/var\/qmail\/queue\/info\/0\/1445826<br \/>\n\/var\/qmail\/queue\/remote\/0\/1445826<\/p>\n<p>Now open the file to read the email body. Choose the file part contains message (\/var\/qmail\/queue\/mess\/0\/1445826)<br \/>\n[root@mail4 ~]# cat \/var\/qmail\/queue\/mess\/0\/1445826 | more<br \/>\nReceived: (qmail 20473 invoked by uid 0); 4 Dec 2012 17:12:24 -0000<br \/>\nDate: 4 Dec 2012 17:12:24 -0000<br \/>\nMessage-ID: <20121204171224.20472.qmail@mail4.test.com><br \/>\nTo: apet@aximo.com<br \/>\nSubject: Better than EQP<br \/>\nFrom: Uniline Promo Inc <noreply@test.com><br \/>\nReply-To: Uniline Promo Inc <info@test.com><br \/>\nMIME-Version: 1.0<br \/>\nContent-type: multipart\/alternative; boundary=&#8221;_d96476de58f15ff5cda2ac8a00860156&#8243;<br \/>\nThis is a multi-part message in MIME format.<br \/>\n&#8211;_d96476de58f15ff5cda2ac8a00860156<br \/>\nContent-Type: text\/plain; charset=&#8221;iso-8859-1&#8243;<br \/>\nContent-Transfer-Encoding: 7bit<\/p>\n<p>Now you can see the email subject from the email message part. You may need to install another third party tool to remove the email having the specified the Subject from the queue.<\/p>\n<p>C. Install qmail-remove script<br \/>\nDownload this package from http:\/\/www.linuxmagic.com\/opensource\/qmail\/qmail-remove\/qmail-remove-0.95.tar.gz<br \/>\n#wget http:\/\/www.linuxmagic.com\/opensource\/qmail\/qmail-remove\/qmail-remove-0.95.tar.gz<br \/>\n#tar -zxvf mail-remove-0.95.tar.gz<br \/>\n#cd mail-remove-0.95<br \/>\n#make &#038;&#038; make install<br \/>\n#ln -s \/usr\/local\/sbin\/qmail-remove \/usr\/bin\/qmail-remove<br \/>\n#mkdir -p \/var\/qmail\/queue\/yanked\/<\/p>\n<p>\/var\/qmail\/queue\/yanked\/ \u2013> This folder would have store all the files those are moved through this script.<\/p>\n<p>D. Delete the specified emails having the same subject<br \/>\n#\/etc\/init.d\/qmail stop<br \/>\n#qmail-remove -r -p &#8220;email subject name&#8221;<\/p>\n<p>How to check the email sending statistics<\/p>\n<p>[root@mail4 yanked]# \/var\/qmail\/bin\/qmail-qstat<br \/>\nmessages in queue: 30835<br \/>\nmessages in queue but not yet preprocessed: 230<br \/>\n[root@mail4 yanked]#<\/p>\n<p>If you want to remove all the email from a particular user \u201cspamsender@serveridol.com\u201d, just execute the command as shown below<br \/>\n[root@rc-025 test]#qmail-remove -r -p &#8220;spamsender@serveridol.com&#8221;<\/p>\n<p>Also I found another useful tool (qmHandle) for listing the email headers including sender,receiver address along with the email subject. So that we can identify the whether the email is spam or not and also we can use these information for pattern match deletion.<\/p>\n<p>[root@rc-025 test]#http:\/\/nchc.dl.sourceforge.net\/project\/qmhandle\/qmhandle-1.3\/qmhandle-1.3.2\/qmhandle-1.3.2.tar.gz<br \/>\n[root@rc-025 test]# tar -zxvf qmhandle-1.3.2.tar.gz &#038;&#038; cd qmhandle-1.3.2<br \/>\n[root@rc-025 qmhandle-1.3.2]# cp qmHandle \/usr\/bin<\/p>\n<p>How to list the Queued emails<br \/>\n[root@rc-025 test]# qmHandle -R<br \/>\n402725179 (9, 9\/402725179)<br \/>\n  Return-path: kathy@asd.com<br \/>\n  From: Kathy Keeton <kathy@asd.com><br \/>\n  To: &#8220;themoonga5@ail.com&#8221; <themoonga5@ail.com>\n  Subject: Cheer registration<br \/>\n  Date: Wed, 3 Apr 2013 08:42:18 -0400<br \/>\n  Size: 1147 bytes<br \/>\nTotal messages: 1<br \/>\nMessages with local recipients: 0<br \/>\nMessages with remote recipients: 1<br \/>\nMessages with bounces: 0<br \/>\nMessages in preprocess: 0<\/p>\n<p>Reviewing the queued emails [How to store all queued email informations before delete]<br \/>\n[root@rc-025 test]#qmHandle -R > \/tmp\/remotequeue.txt<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Identify the email header id from the queued emails.. I\u2019m goingg to use \u201cqmail-qstat\u201d command to know the email header. ID will starts with # symbal eg. #1445826 [root@mail4 ~]# \/var\/qmail\/bin\/qmail-qread | more 4 Dec 2012 17:04:33 GMT #1442054 7146 remote admin@sample.com 4 Dec 2012 17:06:16 GMT #1442974 7048 remote admin@samplesouth.net 4 Dec 2012 17:08:47 &#8230; <a title=\"Qmail : Removing emails from queue having the specified Subject\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/10\/08\/qmail-removing-emails-queue-specified-subject\/\" aria-label=\"Read more about Qmail : Removing emails from queue having the specified Subject\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92],"tags":[],"class_list":["post-752","post","type-post","status-publish","format-standard","hentry","category-qmail"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=752"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/752\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}