Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send HTML formatted mail using PHP?

Trying to send a html email via mail(), however gmail just displays the email as plain text, no mark up, eg:

mail("[email protected]", "subject", "<i>Italic Text</i>");

just appears as

<i>Italic Text</i>

Any ideas?

like image 598
DexCurl Avatar asked Apr 19 '11 11:04

DexCurl


2 Answers

You have to specify that the contents of the mail is HTML:

mail("[email protected]", "subject", "<i>Italic Text</i>", "Content-type: text/html; charset=iso-8859-1");
like image 190
rael_kid Avatar answered Oct 05 '22 21:10

rael_kid


See example 4 on this page:

http://php.net/manual/en/function.mail.php

like image 23
Daniel A. White Avatar answered Oct 05 '22 20:10

Daniel A. White