PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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:
$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");
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.
/* 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);