Yahoo shows my PHP formatted HTML but Gmail Doesn't

119 views
Skip to first unread message

cybervigilante

unread,
Apr 29, 2007, 9:01:24 PM4/29/07
to Gmail-Users
I sent HTML formatted email, using PHP, to my Yahoo address from my
server, and it came out fine, styles and all. I sent it to my gmail
address to test it and all I see is the raw html code. But I do get
formatted email in gmail, so I know people make it work somehow. What
do you do different in gmail to get formatted HTML email?

Here is my PHP code, which Does receive correctly, with color and
formatting, in Yahoo mail, but not gmail.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>PHP Guestbook</title>
</head>
<body>

<h1>mailtest</h1>


<?php

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$msg = "<h2 style='color:red; background-color: Fuchsia; border: thick
dotted; border-color: Blue; font-family: sans-serif; font-style:
italic; margin-left: 20%; padding: 20; margin-right: 30%;'>Test of
formatted email from <br>Just Health Now server, with html headers</
h2>";
echo ($msg);

mail("ser...@yahoo.com","no damn color",$msg,$headers);


?>


</body>
</html>

Ryan Morehart

unread,
Apr 30, 2007, 12:49:19 PM4/30/07
to Gmail...@googlegroups.com
I have no clue, the code looks fine. Have you compared the headers and all that of an HTML email that Gmail handled fine to what your script sent? (To see them in Gmail, click on the arrow in the upper right hand corner of a message and click "Show original.") It might be that Gmail is looking for something beyond the MIME type.

Ryan

compute...@gmail.com

unread,
May 1, 2007, 11:55:21 AM5/1/07
to Gmail-Users
It may just be that Yahoo! Mail understands PHP and so formats it
correctly but Gmail does not. Try going to the Gmail suggestion page
@ https://services.google.com/inquiry/gmail_suggest/ and suggest that
feature.

On Apr 30, 11:49 am, "Ryan Morehart" <moreh...@gmail.com> wrote:
> I have no clue, the code looks fine. Have you compared the headers and all
> that of an HTML email that Gmail handled fine to what your script sent? (To
> see them in Gmail, click on the arrow in the upper right hand corner of a
> message and click "Show original.") It might be that Gmail is looking for
> something beyond the MIME type.
>
> Ryan
>

> On 4/29/07, cybervigilante <cybervigila...@gmail.com> wrote:
>
>
>
> > I sent HTML formatted email, using PHP, to my Yahoo address from my
> > server, and it came out fine, styles and all. I sent it to my gmail
> > address to test it and all I see is the raw html code. But I do get
> > formatted email in gmail, so I know people make it work somehow. What
> > do you do different in gmail to get formatted HTML email?
>
> > Here is my PHP code, which Does receive correctly, with color and
> > formatting, in Yahoo mail, but not gmail.
>
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > <html lang="en">
> > <head>
> > <title>PHP Guestbook</title>
> > </head>
> > <body>
>
> > <h1>mailtest</h1>
>
> > <?php
>
> > $headers = "MIME-Version: 1.0\r\n";
> > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
>
> > $msg = "<h2 style='color:red; background-color: Fuchsia; border: thick
> > dotted; border-color: Blue; font-family: sans-serif; font-style:
> > italic; margin-left: 20%; padding: 20; margin-right: 30%;'>Test of
> > formatted email from <br>Just Health Now server, with html headers</
> > h2>";
> > echo ($msg);
>

> > mail("sere...@yahoo.com","no damn color",$msg,$headers);
>
> > ?>
>
> > </body>
> > </html>

DJ Flea

unread,
May 12, 2007, 8:15:41 PM5/12/07
to Gmail-Users
Change your \r\n to just \n.


On Apr 30, 11:49 am, "Ryan Morehart" <moreh...@gmail.com> wrote:

> I have no clue, the code looks fine. Have you compared the headers and all
> that of an HTML email that Gmail handled fine to what your script sent? (To
> see them in Gmail, click on the arrow in the upper right hand corner of a
> message and click "Show original.") It might be that Gmail is looking for
> something beyond the MIME type.
>
> Ryan
>

> On 4/29/07, cybervigilante <cybervigila...@gmail.com> wrote:
>
> > I sent HTML formatted email, using PHP, to my Yahoo address from my
> > server, and it came out fine, styles and all. I sent it to my gmail
> > address to test it and all I see is the raw html code. But I do get
> > formatted email in gmail, so I know people make it work somehow. What
> > do you do different in gmail to get formatted HTML email?
>
> > Here is my PHP code, which Does receive correctly, with color and
> > formatting, in Yahoo mail, but not gmail.
>
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > <html lang="en">
> > <head>
> > <title>PHP Guestbook</title>
> > </head>
> > <body>
>
> > <h1>mailtest</h1>
>
> > <?php
>
> > $headers = "MIME-Version: 1.0\r\n";
> > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
>
> > $msg = "<h2 style='color:red; background-color: Fuchsia; border: thick
> > dotted; border-color: Blue; font-family: sans-serif; font-style:
> > italic; margin-left: 20%; padding: 20; margin-right: 30%;'>Test of
> > formatted email from <br>Just Health Now server, with html headers</
> > h2>";
> > echo ($msg);
>

> > mail("sere...@yahoo.com","no damn color",$msg,$headers);
>
> > ?>
>
> > </body>
> > </html>

Reply all
Reply to author
Forward
0 new messages