{"id":51,"date":"2014-02-11T22:23:01","date_gmt":"2014-02-11T22:23:01","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=6"},"modified":"2014-02-11T22:23:01","modified_gmt":"2014-02-11T22:23:01","slug":"qmail-wrapper","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/02\/11\/qmail-wrapper\/","title":{"rendered":"Qmail Wrapper"},"content":{"rendered":"<p>Use this method to track down any PHP scripts that might be sending email.<br \/>\nhttp:\/\/kb.parallels.com\/en\/1711<\/p>\n<p>1) Create a \/var\/qmail\/bin\/sendmail-wrapper script with the following content:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#!\/bin\/sh\n(echo X-Additional-Header: $PWD ;cat) | tee -a \/var\/tmp\/mail.send|\/var\/qmail\/bin\/sendmail-qmail &quot;$@&quot;\n<\/pre>\n<p>Note, it should be two lines including \u2018#!\/bin\/sh\u2019.<\/p>\n<p>2) Create a log file \/var\/tmp\/mail.send and grant it \u201ca+rw\u201d rights; make the wrapper executable; rename old sendmail; and link it to the new wrapper:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ntouch \/var\/tmp\/mail.send\nchmod a+rw \/var\/tmp\/mail.send\nchmod a+x \/var\/qmail\/bin\/sendmail-wrapper\nmv \/var\/qmail\/bin\/sendmail \/var\/qmail\/bin\/sendmail-qmail\nln -s \/var\/qmail\/bin\/sendmail-wrapper \/var\/qmail\/bin\/sendmail\n<\/pre>\n<p>3) Wait for an hour and change back sendmail:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrm -f \/var\/qmail\/bin\/sendmail\nmv \/var\/qmail\/bin\/sendmail-qmail \/var\/qmail\/bin\/sendmail\n<\/pre>\n<p>Examine the \/var\/tmp\/mail.send file. There should be lines starting with \u201cX-Additional-Header:\u201d pointing to domain folders where the scripts which sent the mail are located.<br \/>\nYou can see all the folders from where mail PHP scripts were run with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ngrep X-Additional \/var\/tmp\/mail.send | grep `cat \/etc\/psa\/psa.conf | grep HTTPD_VHOSTS_D | sed -e &#039;s\/HTTPD_VHOSTS_D\/\/&#039; `\n<\/pre>\n<p>If you see no output from the above command, it means that no mail was sent using the PHP mail() function from the Plesk virtual hosts directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use this method to track down any PHP scripts that might be sending email. http:\/\/kb.parallels.com\/en\/1711 1) Create a \/var\/qmail\/bin\/sendmail-wrapper script with the following content: #!\/bin\/sh (echo X-Additional-Header: $PWD ;cat) | tee -a \/var\/tmp\/mail.send|\/var\/qmail\/bin\/sendmail-qmail &quot;$@&quot; Note, it should be two lines including \u2018#!\/bin\/sh\u2019. 2) Create a log file \/var\/tmp\/mail.send and grant it \u201ca+rw\u201d rights; make the &#8230; <a title=\"Qmail Wrapper\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/02\/11\/qmail-wrapper\/\" aria-label=\"Read more about Qmail Wrapper\">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":[86],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-plesk"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/51","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=51"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}