Page 1 of 1

HTML in emails

Posted: Thu Dec 09, 2004 8:44 pm
by Wldrumstcs
Ok, I have an email that is being sent to users. How do I include HTML in it because right now it is actually displaying the html. My code is as follows:

Code: Select all

$subject = "Login Info.";
$emailbody = "
Here is your login information:

USERNAME:  $_POST[username]
PASSWORD:  alsdlf;jas;ldjf;lakshdfg

Your old password was reset to this default password.  To change your password you must <a href='http://www.----.com'>Login</a>, then click on 'Update Your Profile.'

If you have any questions whatsoever, feel free to email the department head <a href='mailto:--@-----.com'>-- -----</a> or the <a href='mailto:---@-----.com>webmaster</a>.
-------------------------------------------
This is an automatically generated email.  Please DO NOT respond.";
mail($email_result, $subject, $emailbody, "From: Webmaster");
Thanks!

Posted: Thu Dec 09, 2004 8:53 pm
by Benjamin
You will have to research e-mail headers, and create an e-mail header which indicates the content-type is html. I have never done it so I can't tell you more than that.

Posted: Thu Dec 09, 2004 9:40 pm
by dull1554
out of the manual***

Code: Select all

/* To send HTML mail, you can set the Content-type header. */ 
$headers  = "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 

/* additional headers */ 
$headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n"; //if you dont set these headers (to and from, most spam assasins will mark them as spam!!
$headers .= "From: Birthday Reminder <birthday@example.com>\r\n"; 

/* and now mail it */ 
mail($to, $subject, $message, $headers);