weee Posted November 19, 2010 Share Posted November 19, 2010 Hello Everyone, I am having an interesting problem trying to pipe emails. When I send an email that contains html or has an attachment, my script is given a null value. After doing a little bit of research, I found this post and this is the exact same issue that I seem to be having with my application: http://www.computing.net/answers/webdevel/email-piping-format-php/1072.html Does anyone know of a solution to allow the extra content such as the html or attachments? Thank you in advance! weee Quote Link to comment https://forums.phpfreaks.com/topic/219140-email-piping/ Share on other sites More sharing options...
WatsonN Posted November 19, 2010 Share Posted November 19, 2010 Add this header to your email script and it will allow html $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; This is a good article to show you how to do HTML and attachments. http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php#attachment Quote Link to comment https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136420 Share on other sites More sharing options...
weee Posted November 19, 2010 Author Share Posted November 19, 2010 Actually I think this problem might be caused by something else. If I have this as my php file: #!/usr/bin/php5 -q <?php $input = ''; $stdin = fopen('php://stdin', 'r'); while (!feof($stdin)) { $input .= fread($stdin, 8192); } fclose($stdin); $file = fopen('blah.txt', 'r'); fwrite($file, 'this is some text'); fclose($file); ?> Nothing will be written. Now what is weird is if I execute the script via my web browser (http://localhost/cli.php) the blah.txt file is written. I have chmoded the file to 777 to allow all users to try to write with this file... What is crazy though is I enabled error logging on my server and it isn't giving me any errors or warnings about the permissions. I am 100% sure it is executing because I can use the mail() function to fire off a test message. Any ideas? Regards, weee Quote Link to comment https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136426 Share on other sites More sharing options...
weee Posted November 19, 2010 Author Share Posted November 19, 2010 Sorry for the double post but I have narrowed this down to this being something regarding email piping and not the script itself. I can execute the script via webbrowser and CLI and everything works. The script only doesn't write the file when it is actually executed when the email is forwarded to the php script. Could someone please move this to the linux section? Thank you, weee Quote Link to comment https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136448 Share on other sites More sharing options...
Pikachu2000 Posted November 19, 2010 Share Posted November 19, 2010 Could someone please move this to the linux section? Thank you, weee Sure thing. Done. Quote Link to comment https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136477 Share on other sites More sharing options...
jdavidbakr Posted January 11, 2011 Share Posted January 11, 2011 Look at http://code.google.com/p/php-mime-mail-parser/ for a possible solution - I use this in a PHP script that handles incoming mail piped to it. Quote Link to comment https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1157961 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.