Results 1 to 2 of 2

Thread: php mail

  1. #1
    Join Date
    Jul 2008
    Posts
    81
    Thanks
    38
    Thanked 2 Times in 2 Posts

    Default php mail

    Hi

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

    Thanks

  2. #2
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear lord22:

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

    Code:
    $headers .= "Content-Type: text/html; charset=UTF-8;\n";
    and then you can add tags to the body, such as:

    Code:
    $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).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •