PDA

View Full Version : php mail



lord22
08-12-2008, 06:39 AM
Hi

How can I add html tags (like divs, style etc.), to an email which is sent by PHP?

Thanks

kuau
08-12-2008, 12:29 PM
Dear lord22:

In the php you can add this as one of your header lines:


$headers .= "Content-Type: text/html; charset=UTF-8;\n";

and then you can add tags to the body, such as:


$message .= "<br><br><a href=\"www.website.com\">website</a>";

There is another more complicated (in the php) way whereby you can create the html message as a separate file (easier html). If you do it that way, make sure not to use an external file for the css as the email doesn't always arrive at its destination looking the way you intended. Keep it all in the header, and it's forgiveable to use tables to keep the format in this case (IMHO). :)