<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Recieve E-mail and Save Attachments with a PHP script</title>
	<atom:link href="http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/</link>
	<description>Programming, Rambling and More!</description>
	<lastBuildDate>Tue, 10 Jan 2012 06:57:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: stuporglue</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-828</link>
		<dc:creator>stuporglue</dc:creator>
		<pubDate>Tue, 10 Jan 2012 06:57:22 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-828</guid>
		<description>The problem is that my script is not looking for inline content, only for attached content. With the way you have attached the file, it is inline, hence the 
&lt;code&gt;
Content-Disposition: inline;
    filename=CV-IT.pdf&lt;/code&gt;

If you attach it, you would instead see
&lt;code&gt;Content-Disposition: attachment; filename=&quot;CV-IT.pdf&quot;&lt;/code&gt;

The Content-Disposition handling is around line 54-64.</description>
		<content:encoded><![CDATA[<p>The problem is that my script is not looking for inline content, only for attached content. With the way you have attached the file, it is inline, hence the<br />
<code><br />
Content-Disposition: inline;<br />
    filename=CV-IT.pdf</code></p>
<p>If you attach it, you would instead see<br />
<code>Content-Disposition: attachment; filename="CV-IT.pdf"</code></p>
<p>The Content-Disposition handling is around line 54-64.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stuporglue</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-827</link>
		<dc:creator>stuporglue</dc:creator>
		<pubDate>Tue, 10 Jan 2012 06:53:03 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-827</guid>
		<description>Yes, PHP has lots of functions and can do pretty much anything you want it to. 

I&#039;d probably start with these
&lt;ul&gt;
	&lt;li&gt;http://php.net/manual/en/function.fopen.php&lt;/li&gt;
	&lt;li&gt;http://php.net/manual/en/function.fwrite.php&lt;/li&gt;
	&lt;li&gt;http://php.net/manual/en/function.fclose.php&lt;/li&gt;
&lt;/ul&gt;



or possibly 
&lt;ul&gt;&lt;li&gt;http://php.net/manual/en/function.file-put-contents.php&lt;/li&gt;&lt;/ul&gt;</description>
		<content:encoded><![CDATA[<p>Yes, PHP has lots of functions and can do pretty much anything you want it to. </p>
<p>I&#8217;d probably start with these</p>
<ul>
<li><a href="http://php.net/manual/en/function.fopen.php" rel="nofollow">http://php.net/manual/en/function.fopen.php</a></li>
<li><a href="http://php.net/manual/en/function.fwrite.php" rel="nofollow">http://php.net/manual/en/function.fwrite.php</a></li>
<li><a href="http://php.net/manual/en/function.fclose.php" rel="nofollow">http://php.net/manual/en/function.fclose.php</a></li>
</ul>
<p>or possibly </p>
<ul>
<li><a href="http://php.net/manual/en/function.file-put-contents.php" rel="nofollow">http://php.net/manual/en/function.file-put-contents.php</a></li>
</ul>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Harrower</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-825</link>
		<dc:creator>Russell Harrower</dc:creator>
		<pubDate>Tue, 10 Jan 2012 00:22:14 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-825</guid>
		<description>the error I think is that mail (apple and outlook) send some attachments like images as base 64.

Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=&quot;Twalk.ly-iPhone.png&quot;

...long base64 content blob cut...</description>
		<content:encoded><![CDATA[<p>the error I think is that mail (apple and outlook) send some attachments like images as base 64.</p>
<p>Content-Type: image/png<br />
Content-Transfer-Encoding: base64<br />
Content-Disposition: attachment; filename=&#8221;Twalk.ly-iPhone.png&#8221;</p>
<p>&#8230;long base64 content blob cut&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Harrower</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-824</link>
		<dc:creator>Russell Harrower</dc:creator>
		<pubDate>Mon, 09 Jan 2012 22:25:51 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-824</guid>
		<description>is there away to save the whole email just incase it does not save correctly like in a blob formate or something.</description>
		<content:encoded><![CDATA[<p>is there away to save the whole email just incase it does not save correctly like in a blob formate or something.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stuporglue</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-823</link>
		<dc:creator>stuporglue</dc:creator>
		<pubDate>Mon, 09 Jan 2012 14:28:51 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-823</guid>
		<description>I only ever used it with Gmail. If you want compatibility with everything, you&#039;ll probably need a better email parser, like maybe the PECL Mailparse library, or perhaps something in Perl.</description>
		<content:encoded><![CDATA[<p>I only ever used it with Gmail. If you want compatibility with everything, you&#8217;ll probably need a better email parser, like maybe the PECL Mailparse library, or perhaps something in Perl.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stuporglue</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-822</link>
		<dc:creator>stuporglue</dc:creator>
		<pubDate>Mon, 09 Jan 2012 14:21:14 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-822</guid>
		<description>I&#039;d start by checking permissions. The script probably runs with mail server permissions, not with web server permissions.</description>
		<content:encoded><![CDATA[<p>I&#8217;d start by checking permissions. The script probably runs with mail server permissions, not with web server permissions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Harrower</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-821</link>
		<dc:creator>Russell Harrower</dc:creator>
		<pubDate>Mon, 09 Jan 2012 12:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-821</guid>
		<description>however the attachments are not saving form what I can see. i get this email back

Thanks! I just uploaded the following files to your storage:

Filename -- Size
1326110501_1326110501_Twalk.ly-iPhone.png -- 199.28 KB
1326110501_1326110501_tigerwifi.png -- 334.51 KB

however the URL that it needs to save to 
$save_directory = &quot;/home/telecho/public_html/private/email/attachments&quot;;

seems not to save.</description>
		<content:encoded><![CDATA[<p>however the attachments are not saving form what I can see. i get this email back</p>
<p>Thanks! I just uploaded the following files to your storage:</p>
<p>Filename &#8212; Size<br />
1326110501_1326110501_Twalk.ly-iPhone.png &#8212; 199.28 KB<br />
1326110501_1326110501_tigerwifi.png &#8212; 334.51 KB</p>
<p>however the URL that it needs to save to<br />
$save_directory = &#8220;/home/telecho/public_html/private/email/attachments&#8221;;</p>
<p>seems not to save.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Harrower</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-820</link>
		<dc:creator>Russell Harrower</dc:creator>
		<pubDate>Mon, 09 Jan 2012 11:52:28 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-820</guid>
		<description>I found that it works fine from gmail.com but when sending attachments from mac mail it does not work. I&#039;ll test in outlook tomorrow.</description>
		<content:encoded><![CDATA[<p>I found that it works fine from gmail.com but when sending attachments from mac mail it does not work. I&#8217;ll test in outlook tomorrow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stuporglue</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-784</link>
		<dc:creator>stuporglue</dc:creator>
		<pubDate>Sat, 10 Dec 2011 08:30:13 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-784</guid>
		<description>Make sure that the folder&#039;s permissions are writable by the user the script is running as. 

In your case, I believe that the group will be nobody, and the user will be whatever 

user = “${lookup{$domain}lsearch* {/etc/virtual/domainowners}{$value}}”

evaluates to. 

On my server I think the script gets run by the mail server user. 

For testing only (because it&#039;s a security risk) you could change the permissions to 777, see if it gets written, and then you&#039;d know if paths are right. 

You could also add 
&lt;code&gt;print `whoami`;&lt;/code&gt; 
to the top of the PHP script and change your exim.conf  
&lt;code&gt;#...Set return_fail_output
# instead of return_output if you want this to happen only when the pipe fails
# to complete normally. &lt;/code&gt;
This would send the results of `whoami` back to you (also do &quot;print getcwd();&quot;, etc. to figure out what&#039;s going on. 

Don&#039;t forget to fix your permissions when you&#039;re done.</description>
		<content:encoded><![CDATA[<p>Make sure that the folder&#8217;s permissions are writable by the user the script is running as. </p>
<p>In your case, I believe that the group will be nobody, and the user will be whatever </p>
<p>user = “${lookup{$domain}lsearch* {/etc/virtual/domainowners}{$value}}”</p>
<p>evaluates to. </p>
<p>On my server I think the script gets run by the mail server user. </p>
<p>For testing only (because it&#8217;s a security risk) you could change the permissions to 777, see if it gets written, and then you&#8217;d know if paths are right. </p>
<p>You could also add<br />
<code>print `whoami`;</code><br />
to the top of the PHP script and change your exim.conf<br />
<code>#...Set return_fail_output<br />
# instead of return_output if you want this to happen only when the pipe fails<br />
# to complete normally. </code><br />
This would send the results of `whoami` back to you (also do &#8220;print getcwd();&#8221;, etc. to figure out what&#8217;s going on. </p>
<p>Don&#8217;t forget to fix your permissions when you&#8217;re done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anaa</title>
		<link>http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/comment-page-1/#comment-783</link>
		<dc:creator>anaa</dc:creator>
		<pubDate>Sat, 10 Dec 2011 08:13:31 +0000</pubDate>
		<guid isPermaLink="false">http://stuporglue.org/?p=369#comment-783</guid>
		<description>OK I have fixed that problem by adding a file exim.conf  in root/etc folder 
contents of that file are
# This transport is used for handling pipe deliveries generated by alias
# or .forward files. If the pipe generates any standard output, it is returned
# to the sender of the message as a delivery error. Set return_fail_output
# instead of return_output if you want this to happen only when the pipe fails
# to complete normally. You can set different transports for aliases and
# forwards if you want to - see the references to address_pipe in the directors
# section below.

address_pipe:
driver = pipe
return_fail_output

virtual_address_pipe:
driver = pipe
group = nobody
return_fail_output
user = &quot;${lookup{$domain}lsearch* {/etc/virtual/domainowners}{$value}}&quot;

now the second problem is I&#039;m unable to store any attachment in the specified folder :( where am I going wrong. Please help

Thanks</description>
		<content:encoded><![CDATA[<p>OK I have fixed that problem by adding a file exim.conf  in root/etc folder<br />
contents of that file are<br />
# This transport is used for handling pipe deliveries generated by alias<br />
# or .forward files. If the pipe generates any standard output, it is returned<br />
# to the sender of the message as a delivery error. Set return_fail_output<br />
# instead of return_output if you want this to happen only when the pipe fails<br />
# to complete normally. You can set different transports for aliases and<br />
# forwards if you want to &#8211; see the references to address_pipe in the directors<br />
# section below.</p>
<p>address_pipe:<br />
driver = pipe<br />
return_fail_output</p>
<p>virtual_address_pipe:<br />
driver = pipe<br />
group = nobody<br />
return_fail_output<br />
user = &#8220;${lookup{$domain}lsearch* {/etc/virtual/domainowners}{$value}}&#8221;</p>
<p>now the second problem is I&#8217;m unable to store any attachment in the specified folder :( where am I going wrong. Please help</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

