Link to home
Create AccountLog in
Avatar of Solutionabc
Solutionabc

asked on

PHP read email

Hi,
I am using the below code to receives piped emails.

When I review the email after the script has read it, it's filled with all kinds of characters with the email message buried within. How can I extract the email message from the $email variable?

Or do I have to change the way it is reading the email?
I also want to be able to get attachments on emails.

Is there a better solution?

thanks.
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd))
{
	$email .= fread($fd, 1024);
}
fclose($fd);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mpickreign
mpickreign
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Solutionabc
Solutionabc

ASKER

How could I adapt my code above to work with the code in the link?

http://www.weberdev.com/get_example-1607.html

thanks,