<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>qmail Архиви - rosen4o.net</title>
	<atom:link href="https://rosen4o.net/tag/qmail/feed/" rel="self" type="application/rss+xml" />
	<link>https://rosen4o.net/tag/qmail/</link>
	<description></description>
	<lastBuildDate>Tue, 20 May 2014 08:54:13 +0000</lastBuildDate>
	<language>bg-BG</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>catch spam from apache</title>
		<link>https://rosen4o.net/2014/05/20/catch-spam-from-apache/</link>
					<comments>https://rosen4o.net/2014/05/20/catch-spam-from-apache/#respond</comments>
		
		<dc:creator><![CDATA[rosen4o]]></dc:creator>
		<pubDate>Tue, 20 May 2014 08:53:53 +0000</pubDate>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[qmail]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[spam]]></category>
		<guid isPermaLink="false">http://rosen4o.net/?p=1006</guid>

					<description><![CDATA[<p>Sometimes is very hard to debug from which virtual host spam is This can be check very easy with this trick create a new file  vim /usr/local/bin/phpsendmail place inside it #!/usr/bin/php &#60;?php $sendmail = &#8216;/usr/sbin/sendmail&#8217;; $logfile = &#8216;/var/log/mail.form&#8217;; /* Get<span class="ellipsis">&#8230;</span></p>
<div class="read-more"><a href="https://rosen4o.net/2014/05/20/catch-spam-from-apache/">Прочетете повече ›</a></div>
<p><!-- end of .read-more --></p>
<p>Материалът <a href="https://rosen4o.net/2014/05/20/catch-spam-from-apache/">catch spam from apache</a> е публикуван за пръв път на <a href="https://rosen4o.net">rosen4o.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Sometimes is very hard to debug from which virtual host spam is<br />
This can be check very easy with this trick</p>
<p>create a new file</p>
<p style="padding-left: 30px;"> <strong>vim /usr/local/bin/phpsendmail</strong></p>
<p>place inside it</p>
<p style="padding-left: 30px;"><strong>#!/usr/bin/php</strong><br />
<strong> &lt;?php</strong></p>
<p style="padding-left: 30px;"><strong>$sendmail = &#8216;/usr/sbin/sendmail&#8217;;</strong><br />
<strong> $logfile = &#8216;/var/log/mail.form&#8217;;</strong></p>
<p style="padding-left: 30px;"><strong>/* Get email content */</strong><br />
<strong> $logline = &#8220;;</strong><br />
<strong> $mail = &#8220;;</strong><br />
<strong> $fp = fopen(&#8216;php://stdin&#8217;, &#8216;r&#8217;);</strong></p>
<p style="padding-left: 30px;"><strong>while ($line = fgets($fp))</strong><br />
<strong> {</strong><br />
<strong> if(preg_match(&#8216;/^to:/i&#8217;, $line) || preg_match(&#8216;/^from:/i&#8217;, $line))</strong><br />
<strong> {</strong><br />
<strong> $logline .= trim($line).&#8217; &#8216;;</strong><br />
<strong> }</strong><br />
<strong> $mail .= $line;</strong><br />
<strong> }</strong></p>
<p style="padding-left: 30px;"><strong>/* Build sendmail command */</strong><br />
<strong> $cmd = &#8216;echo &#8216; . escapeshellarg($mail) . &#8216; | &#8216;.$sendmail.&#8217; -t -i&#8217;;</strong><br />
<strong> for ($i = 1; $i &lt; $_SERVER[&#8216;argc&#8217;]; $i++)</strong><br />
<strong> {</strong><br />
<strong> $cmd .= escapeshellarg($_SERVER[&#8216;argv&#8217;][$i]).&#8217; &#8216;;</strong><br />
<strong> }</strong></p>
<p style="padding-left: 30px;"><strong>/* Log line */</strong><br />
<strong> $path = isset($_ENV[&#8216;PWD&#8217;]) ? $_ENV[&#8216;PWD&#8217;] : $_SERVER[&#8216;PWD&#8217;];</strong><br />
<strong> file_put_contents($logfile, date(&#8216;Y-m-d H:i:s&#8217;) . &#8216; &#8216; . $logline .&#8217;  ==&gt; &#8216; .$path.&#8220;\n&#8220;, FILE_APPEND);</strong></p>
<p style="padding-left: 30px;"><strong>/* Call sendmail */</strong><br />
<strong> return shell_exec($cmd);</strong><br />
<strong> ?&gt;</strong></p>
<p>Then you need to make it executable</p>
<p style="padding-left: 30px;"><strong>chmod +x /usr/local/bin/phpsendmail</strong></p>
<p style="padding-left: 30px;"><strong>touch /var/log/mail.form</strong></p>
<p style="padding-left: 30px;"><strong>chmod a+w /var/log/mail.form</strong></p>
<p>In your php.ini file you need to add</p>
<p style="padding-left: 30px;"><strong>sendmail_path = /usr/local/bin/phpsendmail</strong></p>
<p>Restart apache</p>
<p>This will cause all emails which are send from apache to be logged in the file /var/log/mail.form</p>
<p>Материалът <a href="https://rosen4o.net/2014/05/20/catch-spam-from-apache/">catch spam from apache</a> е публикуван за пръв път на <a href="https://rosen4o.net">rosen4o.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://rosen4o.net/2014/05/20/catch-spam-from-apache/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
