DexCurl
DexCurl

Reputation: 1703

GMail doesn't mark up email html (sending via PHP)

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

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

just appears as

<i>Italic Text</i>

Any ideas?

Upvotes: 3

Views: 1266

Answers (2)

AllisonC
AllisonC

Reputation: 3100

Try it with css, the i tag is deprecated, not sure if that is causing it...

<span style='font-style:italic;'>Italic Text</span>

Or you could try using the em tag:

<em>Italic Text</em>
.

Upvotes: 0

Ciaran
Ciaran

Reputation: 1904

Have you set your email headers?

// 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);

If yes, do any other email clients have the same problem? Or is it just Gmail?

Upvotes: 3

Related Questions