Hi All, I am facing strange problem right now in my server. I have php 5 installed with all needed rpms in linux server. I am using the mail() with following code. $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: emailaddress\r\n"; $headers .= "Bcc: emailaddress \r\n"; $message = "test"; mail("emailaddress","emailaddress",$message,$headers); Now the message comes in html code. In yahoo mail account the mail is going with html tags applied properly but in gmail and other few mail account, it is going without taking any effect and all tags are just showing. They are coming like Content-type: text/html; charset=iso-8859-1 From: email@email.com <font face=Verdana, Arial, Helvetica, sans-serif size=1><b>test<b></font> in gmail but in yahoo it is coming properly, test Can anyone help me out of this problem? Mark.
function send_mail($myname, $myemail, $contactname, $contactemail,$subject, $message){ $headers =""; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html;\n\tcharset=\"iso-8859-1\"\n"; $headers .= "X-Priority: 3\n"; $headers .= "X-MSMail-Priority: Normal\n"; $headers .= "X-Mailer: MyMailer\n"; $headers .= "To: \"$contactname\" <$contactemail>\n"; $headers .= "From: \"$myname\" <$myemail>\n"; $headers .= "Reply-To: \"$myname\" <$myemail>\n"; return( mail( $contactemail, $subject, urldecode($message), $headers ) ); } PHP: Try this function to send emails and let me know.
$eol="\n"; $headers = "From: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; $headers .= 'MIME-Version: 1.0'.$eol; $headers .= "Content-type: text/html; charset=iso-8859-1".$eol.$eol; PHP: I use this one, never failed me.
Hi Both, this worked like a dream. I removed only '\r' from the code and it started working. Now this is weired i think. Why \r was working perfactly in old server and in new dedicated server it was not working?? Is it php 4 and php 5 problem or is it server security problem? Please let me know for the reason as \r\n combination is in php manual and if it does not work then there must be some big change. Thanks again.