Home > Archive > PHP Programming > April 2007 > php formatted html shows up in Yahoo mail but not gmail
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
php formatted html shows up in Yahoo mail but not gmail
|
|
| cybervigilante 2007-04-29, 9:58 pm |
| 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. I'm
looking right at a gmail message that I copied to Dreamweaver and it's
using Strong and Red text attributes that work in gmail. But mine
don't.
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("seren37@yahoo.com","no damn color",$msg,$headers);
?>
</body>
</html>
| |
| Benjamin 2007-04-29, 9:58 pm |
| On Apr 29, 8:31 pm, 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. I'm
> looking right at a gmail message that I copied to Dreamweaver and it's
> using Strong and Red text attributes that work in gmail. But mine
> don't.
>
> What do you do different in gmail to get formatted HTML email?
In order to reduce confusion, Gmail may display HTML in plain text.
>
> 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>
| |
| Manuel Lemos 2007-04-29, 9:58 pm |
| Hello,
on 04/29/2007 10:31 PM cybervigilante said the following:
> 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. I'm
> looking right at a gmail message that I copied to Dreamweaver and it's
> using Strong and Red text attributes that work in gmail. But mine
> don't.
>
> What do you do different in gmail to get formatted HTML email?
You should not send HTML mail messages with a plain text alternative
part. When you do that, mail systems may take it as a sign of spam, as
real mail programs do not send messages that way.
You should compose a multipart/alternative message that contains a text
part and an HTML mail part.
If you do not know how to do that, take a look at this MIME message
class as it makes that task much simpler. Try the
test_simple_html_mail_message.php script.
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
| |
| Jerry Stuckle 2007-04-29, 9:58 pm |
| Manuel Lemos wrote:
> Hello,
>
> on 04/29/2007 10:31 PM cybervigilante said the following:
>
> You should not send HTML mail messages with a plain text alternative
> part. When you do that, mail systems may take it as a sign of spam, as
> real mail programs do not send messages that way.
>
> You should compose a multipart/alternative message that contains a text
> part and an HTML mail part.
>
> If you do not know how to do that, take a look at this MIME message
> class as it makes that task much simpler. Try the
> test_simple_html_mail_message.php script.
>
> http://www.phpclasses.org/mimemessage
>
>
Actually, you NEED to send both HTML and plain text. Otherwise people
who accept only plain text will not receive it. Any mail with special
encodings (such as HTML) should include a plain text version.
But did you also indicate the content was multi-part, including both
text and text/html content? Did it have the appropriate separators?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
| |
| Geoff Berrow 2007-04-30, 6:59 pm |
| Message-ID: <46354B3D.6080206@acm.org> from Manuel Lemos contained the
following:
>
>You should not send HTML mail messages with a plain text alternative
>part. When you do that, mail systems may take it as a sign of spam, as
>real mail programs do not send messages that way.
s/with/without
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
|
|
|
|
|