# How can I use HTML with the mail script?

**URL:** <https://forum.kirupa.com/t/how-can-i-use-html-with-the-mail-script/63085>\
**Category:** programming\
**Created:** [September 2, 2004, 9:19pm UTC](https://forum.kirupa.com/t/how-can-i-use-html-with-the-mail-script/63085 "2004-09-02T21:19:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![my3brs](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@my3brs](https://forum.kirupa.com/u/my3brs)\
**Post date:** [September 2, 2004, 9:19pm UTC](https://forum.kirupa.com/t/how-can-i-use-html-with-the-mail-script/63085/1 "2004-09-02T21:19:12Z")

</div>

Does anyone know because when i do the html code and then send the script the code just shows up with the email

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2004, 9:23pm UTC](https://forum.kirupa.com/t/how-can-i-use-html-with-the-mail-script/63085/2 "2004-09-02T21:23:15Z")

</div>

Im talking about the php mail(); script

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 3, 2004, 4:23am UTC](https://forum.kirupa.com/t/how-can-i-use-html-with-the-mail-script/63085/3 "2004-09-03T04:23:05Z")

</div>

This is from the PHP help:

> 

/\* recipients \*/  
$to = “Mary \<mary@example.com\>” . ", " ; // note the comma  
$to .= “Kelly \<kelly@example.com\>”;

/\* subject \*/  
$subject = “Birthday Reminders for August”;

/\* message \*/  
$message = ’  
\<html\>  
\<head\>  
\<title\>Birthday Reminders for August\</title\>  
\</head\>  
\<body\>  
\<p\>Here are the birthdays upcoming in August!\</p\>  
\<table\>  
\<tr\>  
\<th\>Person\</th\>\<th\>Day\</th\>\<th\>Month\</th\>\<th\>Year\</th\>  
\</tr\>  
\<tr\>  
\<td\>Joe\</td\>\<td\>3rd\</td\>\<td\>August\</td\>\<td\>1970\</td\>  
\</tr\>  
\<tr\>  
\<td\>Sally\</td\>\<td\>17th\</td\>\<td\>August\</td\>\<td\>1973\</td\>  
\</tr\>  
\</table\>  
\</body\>  
\</html\>  
';

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

/\* additional headers \*/  
$headers .= "From: Birthday Reminder \<birthday@example.com\>  
";

$headers .= "Cc: [birthdayarchive@example.com](mailto:birthdayarchive@example.com)  
";  
$headers .= "Bcc: [birthdaycheck@example.com](mailto:birthdaycheck@example.com)  
";

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

note the headers.

on php site, you will find the perfect mail function. sends html, attachments etc
