Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I am currently using PHP's mail function to send HTML-formatted mail. A user of mine emailed me to say that when forwarded from Hotmail to Gmail, it causes the email to go into plain text. Any idea what might cause that?

I am simply sending the mail like this:

// 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";
$headers .= "From: GamingOnLinux.com Notification <noreply@gamingonlinux.com>\r\n" . "Reply-To: noreply@gamingonlinux.com\r\n";

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

Here's an example of the content:

// message
$message = "
<html>
<head>
<title>New reply to an article you follow on GamingOnLinux.com</title>
</head>
<body>
<img src=\"{$config['website_url']}/randomlogo.php\" alt=\"Gaming On Linux\">
<br />
<p>Hello <strong>{$email_user['username']}</strong>,</p>
<p><strong>{$username}</strong> has replied to an article you follow on titled \"<strong><a href=\"{$config['website_url']}/articles/$title_nice.$article_id#comments\">{$title['title']}</a></strong>\".</p>
<div>
<hr>
{$comment}
<hr>
You can unsubscribe from this article by <a href=\"{$config['website_url']}/index.php?module=articles_full&go=unsubscribe&article_id={$article_id}\">clicking here</a>, you can manage your subscriptions anytime in your <a href=\"{$config['website_url']}/usercp.php\">User Control Panel</a>.
<hr>
<p>If you haven&#39;t registered at <a href=\"{$config['website_url']}\" target=\"_blank\">{$config['website_url']}</a>, Forward this mail to <a href=\"mailto:liamdawe@gmail.com\" target=\"_blank\">liamdawe@gmail.com</a> with some info about what you want us to do about it or if you logged in and found no message let us know!</p>
<p>Please, Don&#39;t reply to this automated message, We do not read any mails recieved on this email address.</p>
</div>
</body>
</html>
";

It ends up like this on his gmail account

---------- Forwarded message ----------
From: <email hidden>
Date: 2013/5/19
Subject: subject
To: email hidden


Content-type: text/html; charset=iso-8859-1

From: GamingOnLinux.com Notification <noreply@gamingonlinux.com>

Reply-To: noreply@gamingonlinux.com
Message-Id: <20130519092853.0B5482900130@server.prxa.info>
Date: Sun, 19 May 2013 09:28:52 +0000 (UTC)
Return-Path: gamingonlinux@server.prxa.info
X-OriginalArrivalTime: 19 May 2013 09:28:58.0300 (UTC) FILETIME=[4A30AFC0:01CE5473]


                                        <html>
                                        <head>
                                        <title>New reply to an article you follow on GamingOnLinux.com</title>
                                        </head>
                                        <body>
                                        <img src="http://www.gamingonlinux.com/randomlogo.php" alt="Gaming On Linux">
                                        <br />
                                        <p>Hello <strong>username</strong>,</p>
                                        <p><strong>muntdefems</strong> has replied to an article you follow on titled "<strong><a href="http://www.gamingonlinux.com/articles/humble-double-fine-bundle-launches-we-were-right.1982#comments">Humble Double Fine Bundle launches, we were right!</a></strong>".</p>
                                        <div>
                                        <hr>
                                        For what it's worth, in southern Europe Halloween has only been around for a few years and it's mainly an excuse for grown-ups to party and wear slutty costumes. In spite of this, and being aware that I must've missed out on quite a few things, I've enjoyed the game a lot. <img src="/jscripts/sce/emoticons/smile.png" alt="" />
                                        <hr>
                                        You can unsubscribe from this article by <a href="http://www.gamingonlinux.com/index.php?module=articles_full&go=unsubscribe&article_id=1982">clicking here</a>, you can manage your subscriptions anytime in your <a href="http://www.gamingonlinux.com/usercp.php">User Control Panel</a>.
                                        <hr>
                                        <p>If you haven't registered at <a href="http://www.gamingonlinux.com" target="_blank">http://www.gamingonlinux.com</a>, Forward this mail to <a href="mailto:liamdawe@gmail.com" target="_blank">liamdawe@gmail.com</a> with some info about what you want us to do about it or if you logged in and found no message let us know!</p>
                                        <p>Please, Don't reply to this automated message, We do not read any mails recieved on this email address.</p>
                                        </div>
                                        </body>
                                        </html>
share|improve this question
add comment

migrated from superuser.com May 20 '13 at 20:20

This question came from our site for computer enthusiasts and power users.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.