473,573 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php formatted html shows up in Yahoo mail but not gmail

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:re d; 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("se*****@y ahoo.com","no damn color",$msg,$he aders);
?>
</body>
</html>

Apr 30 '07 #1
4 5057
On Apr 29, 8:31 pm, cybervigilante <cybervigila... @gmail.comwrote :
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:re d; 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...@y ahoo.com","no damn color",$msg,$he aders);

?>

</body>
</html>

Apr 30 '07 #2
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_htm l_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/
Apr 30 '07 #3
Manuel Lemos wrote:
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_htm l_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.
js*******@attgl obal.net
=============== ===
Apr 30 '07 #4
Message-ID: <46************ **@acm.orgfrom Manuel Lemos contained the
following:
>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.
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/
Apr 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2456
by: D. Alvarado | last post by:
Hello, DOes anyone have a recommendation for some free code to send out HTML-formatted emails? The code does not have to be cross-browser compatible. Thanks for any advice, - Dave
2
1744
by: Paul Turley | last post by:
Does anyone have some sample code for sending an HTML formatted message using CDONTS? Thanks RE: Sending HTML formatted mail using CDONTS -- Paul Turley, MCSD, MCAD, MCT, MSF Practitioner, A+ Technician
13
5198
by: stam | last post by:
hello guys, i have met a problem that i can send the html e-mail by using MIME via php to yahoo mail and hotmail, but when i was try to send to gmail, it show all the html coding. can someone help me to solve this kind of problem? thank you the coding i made----->: <?php $a=<<<A
4
6100
by: k.visube | last post by:
In my ASP application,i need to send a formatted text mail (i.e with newline characters). here in my application i used a function in javascript which construts the mail body sample snippet strbody=strbody +"dear customer,\n"; strbody=strbody +"we are glad to see ur response\n"; strbody=strbody +"we will make the needful thing as early...
1
2935
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux...
3
3864
by: Pratik Patel | last post by:
Hello I have html generated code. like <table><tr><td><img src="http://www.abc.com/images/abc.jpg"></td></ tr></table> When i copy above code and paste this code in gmail,yahoo or hotmail
1
4573
by: robnoper | last post by:
XP SP2, access and outlook 2003 I have a form with 3 command buttons on that when one is pressed it opens up a html email for the user to send. Two of the emails work fine and open with the full colour and size formatted text but one of them just shows the html code in the body with no formatting. The vba code for the command button is as...
2
18162
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try
1
2814
by: neovantage | last post by:
Hey, I have read an email template and sending emails through php mail function. It shows html code when i open that received email in outlook express but it shows normal content in hotmail, yahoo, gmail account. This is how it view me HTML code in outlook ----Original Message----- From: Sent: None To: <email removed> Subject: File...
0
7789
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7800
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6432
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5605
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3737
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3743
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1048
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.