<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[Many email messages are sent from PHP scripts on the server. How can I find what domains these scripts are running on?]]></title>
<link>http://kb.parallels.com/en/1711</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">Many email messages are sent from PHP scripts on the server. How can I find what domains these scripts are running on?</h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 1711&nbsp;</div>
					<div>Last Review: Mar,16 2009</div>
					<tr>
						<td>Author: </td>
						<td>Vitaly Malakhov</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>Vitaly Malakhov</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Plesk 9.x for Linux/Unix</li>
							<li>Plesk 8.x for Linux/Unix</li>
						</ul>
					</div>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Resolution</h2>
					There is a way to find what the folder the PHP script that sends mail was run from. Note, the paths can be slightly differ from the listed below depending on your OS and Plesk version: <br /><br />1) create /var/qmail/bin/sendmail-wrapper script with the content:<br /><br /><span style='font-family: courier new,courier;font-size: 12px;'>#!/bin/sh<br />(echo X-Additional-Header: $PWD ;cat) | tee -a /var/tmp/mail.send|/var/qmail/bin/sendmail-qmail &quot;$@&quot;</span><br /><br />Note, it should be the two lines including '#!/bin/sh'.<br /> <p>&nbsp;</p><p>&nbsp;2) then create log file /var/tmp/mail.send and grant it &quot;a+rw&quot; rights, make the wrapper executable, rename old sendmail and link it to the new wrapper:</p><p><div class="commandline"><code># touch /var/tmp/mail.send</p><p># chmod a+rw /var/tmp/mail.send</p><p># chmod a+x /var/qmail/bin/sendmail-wrapper</p><p># mv /var/qmail/bin/sendmail /var/qmail/bin/sendmail-qmail</p><p># ln -s /var/qmail/bin/sendmail-wrapper /var/qmail/bin/sendmail</code></div>&nbsp;</p> 3) Wait for an hour or so and revert sendmail back: <br /><div class="commandline"><code># rm -f /var/qmail/bin/sendmail<br /># ln -s /var/qmail/bin/sendmail-qmail /var/qmail/bin/sendmail</code></div> <br /> Examine /var/tmp/mail.send file, there should be lines starting with &quot;X-Additional-Header:&quot; pointing out to domains' folders where the scripts which sent the mail are located. <br /> You can see all the folders mail PHP scripts were run from with the following command:   <br /> <div class="commandline"><code># grep X-Additional /var/tmp/mail.send | grep `cat /etc/psa/psa.conf | grep HTTPD_VHOSTS_D | sed -e 's/HTTPD_VHOSTS_D//' ` </code></div>&nbsp;If you see no output from the command above, it means that no mail was sent using PHP mail() function from the Plesk virtual hosts directory.<br /><br /><br />
				</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1711&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=1711&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '1711',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Vitaly Malakhov</author>
<guid isPermaLink="false">1349 LastUpdated: 2009-03-16 10:07:00</guid>
<pubDate>2007-02-21 01:29:48</pubDate>
</item>
</channel>
</rss>



