Connecting Tech Pros Worldwide Forums | Help | Site Map

Why does HTML email appear normally sometimmes, and sometimes not?

D. Alvarado
Guest
 
Posts: n/a
#1: Jul 17 '05
Hello,
I have signed up a for a Google Gmail account. I sent myself some
PHP-generated HTML emails from two different machines using this code:

$to = "dave@gmail.com";
$id = 1234;
$from = "sender@suppressed.com";
$headers = "MIME-Version: 1.0\r\n"
. "Content-type: text/html;
charset=iso-8859-1\r\n"
. "Content-Transfer-Encoding:
7bit\r\n"
. "From: $from\r\n"
. "X-Mailer: PHP " . phpversion() .
"\r\n"
. "Reply-to: $from";
$body = "<html><head></head><body><a
href='cbssportsline.com'>Link</a><BR><b>Hello</b></body></html>";

if (!mail($to, "hello", $body, $headers)) {
die("Email delivery to $to
failed.\n");
} // if

When I send the email from my dev box, the HTML displays normally on
Gmail. However, when I upload the same code to my hosting company and
send an email, I open my gmail email and there's no HTML formatting
whatsoever. Here's what I see:

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

Content-Transfer-Encoding: 7bit

From: sender@suppressed.com
X-Mailer: PHP 4.3.9

Reply-to: sender@suppressed.com

<html><head></head><body><a
href='cbssportsline.com'>Link</a><BR><b>Hello</b></body></html>

The sender reads "(unknown sender)". Why do I see HTML-formatted
text some times and not others? How should I go about debugging this
problem?

Thanks for your help, - Dave

Manuel Lemos
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Why does HTML email appear normally sometimmes, and sometimes not?


Hello,

On 10/25/2004 10:14 AM, D. Alvarado wrote:[color=blue]
> When I send the email from my dev box, the HTML displays normally on
> Gmail. However, when I upload the same code to my hosting company and
> send an email, I open my gmail email and there's no HTML formatting
> whatsoever. Here's what I see:[/color]

That looks like one of the mail function bugs.

You may want to try this class that implements workarounds for some of
the problems. It also lets you compose and send HTML messages properly.
The way you did it may lead to messages never arriving for instance to
Hotmail accounts and other places.

http://www.phpclasses.org/mimemessage


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Brandon Blackmoor
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Why does HTML email appear normally sometimmes, and sometimes not?


Do not send HTML email. Period.
David
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Why does HTML email appear normally sometimmes, and sometimes not?


sending html email is fine
it's a standard now. (thank heck MS rtf is falling out)
newsgroups are plain text, and email is html. Too common to just "not do it"
imho

"Brandon Blackmoor" <bblackmoor@blackgate.net> wrote in message
news:2u76bvF26uqa5U2@uni-berlin.de...[color=blue]
> Do not send HTML email. Period.[/color]


Closed Thread