Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/219140-email-piping/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136420
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136426
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/219140-email-piping/#findComment-1136448
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.