...

View Full Version : about mail() function



xiaodao
06-07-2005, 06:02 AM
i used following codes

$success=mail($to,$subject,$body);

but the problem is when i send to yahoo mail. the from colunm display "nobody", how to show the sender's name on it.

SeeIT Solutions
06-07-2005, 07:24 AM
try using this


$headers = 'From: Someone <someone@somewhere.com>'."\r\n"; //from
$headers .= 'Content-Type: text/html; charset="ISO-8859-1"'."\r\n"; //if you want content to be html
$success=mail($to,$subject,$body,$headers);

mrruben5
06-07-2005, 11:41 AM
You also have to send a mime header.



<?php
mail('recipient@some.net', 'Subject',
'<html><body><p>Your <i>message</i> here.</p></body></html>',
"To: The Receiver <recipient@some.net>\n" .
"From: The Sender <sender@some.net>\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");
?>


If you want more information there's a good tutorial/article on sitepoint. (http://www.sitepoint.com/article/advanced-email-php)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum