Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: HTML email???
06-12-2007, 10:53 AM #1
in PHP normal mail function
mail($to, $subject, $body)
<a href="link">some text </a>
will the mail be sent as HTML??
if not what should i do to send HTML mail??? any body can help me??Fi®e bLádê
follow me on twitter
06-12-2007, 10:59 AM #2
- Join Date
- Dec 2004
- In a place far, far away...
- Thanked 1,043 Times in 1,019 Posts
The mail() function accepts 4 items. The to email address, the subject, the message, and the headers. If you don't specify the headers the default is text/plain. Put this before you call the mail() function
$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: email@example.com\r\n" . "Reply-To: ".$to."";
mail($to, $subject, $body,$headers)
06-12-2007, 03:59 PM #3
Another tip for html email, use heredoc syntax to build the html of the message. Heredoc behaves like double quotes without having to actually use them. Very handy for html tags with lots of attributes...