What headers would I use with mail() to enable HTML?

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!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

What headers would I use with mail() to enable HTML?

Post by impulse() »

At the moment, my headers section is as follows:

Code: Select all

$headers = ""; 
    $headers .= "Content-Type: text/html; charset=iso-8559-1";
    $headers .= "Content-Transfer-Encoding: 8bit";
But this isn't using HTML tags.

Regards,
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Live and direct from the PHP Manual:

Code: Select all

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

// Mail it
mail($to, $subject, $message, $headers);
Post Reply