asmith Posted January 2, 2008 Share Posted January 2, 2008 hey guys how can i use html tags in my mail message ? $to = "[email protected]"; $sub = "test"; $msg = "<b>hello<b><br />this is a test \n mail!!<p>paragraph</p>"; $head = "From:john"; mail($to,$sub,$msg,$head); the only thing works in he $msg is \n , in shows html tags. or maybe i should ask how can i format the mail message text ? Link to comment https://forums.phpfreaks.com/topic/84090-solved-mail-message-text-format/ Share on other sites More sharing options...
MadTechie Posted January 2, 2008 Share Posted January 2, 2008 Try this <?php // To send HTML mail, the Content-type header must be set $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; // Additional headers $headers .= "To: peter <$to>\r\n"; $headers .= "From: john <[email protected]>\r\n"; $to = "[email protected]"; $sub = "test"; $msg = "<b>hello<b><br />this is a test \n mail!!<p>paragraph</p>"; $msg= nl2br($msg); //convert /n to <br> mail($to,$sub,$msg,$headers); ?> Link to comment https://forums.phpfreaks.com/topic/84090-solved-mail-message-text-format/#findComment-428034 Share on other sites More sharing options...
asmith Posted January 2, 2008 Author Share Posted January 2, 2008 thanks a lot! // To send HTML mail, the Content-type header must be set how many options i got ? how many kind of mails we got ? Link to comment https://forums.phpfreaks.com/topic/84090-solved-mail-message-text-format/#findComment-428036 Share on other sites More sharing options...
MadTechie Posted January 2, 2008 Share Posted January 2, 2008 its not Mail format but Content-type.. the standard HTML page Content-type is text/html, for more info read up on MIME http://en.wikipedia.org/wiki/MIME, UTF-8 = Unicode (your see that used alot as well) *Edit: Typo Link to comment https://forums.phpfreaks.com/topic/84090-solved-mail-message-text-format/#findComment-428038 Share on other sites More sharing options...
asmith Posted January 2, 2008 Author Share Posted January 2, 2008 gotcha! thanks for the information. Link to comment https://forums.phpfreaks.com/topic/84090-solved-mail-message-text-format/#findComment-428041 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.