Php html mail broken in mail clients.

Hello,

I am trying to send html mails using php's mail function. The MTA on the server is qmail.

Now the problem is, the mail appears fine (html format) in some mail clients, like Outlook express, Yahoo mail, hotmail etc. But in Outlook the html is completely broken and all I can see is the html code. Same is the issue with Gmail.

These are the headers am using:

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

Can anyone tell me if am missing any headers?

Please let me know if you want more details.

Thanks
manojoswalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alain34Commented:
use http://phpmailer.sourceforge.net
This product produce html and plain email at the same time.
nicholassolutionsCommented:
nicholassolutionsCommented:
And FYI, here is a valid HTML/plain text mail as an example.

=================BEGIN PASTE================================
From: "John Smith" <js@johnsmith.com>
To: "'John Smith'" <js@johnsmith.com>
Subject: test html mail
Date: Tue, 5 Jul 2005 03:17:51 -0400
Message-ID: <000201c58131$aa4a64f0$6400a8c0@jsmith>
MIME-Version: 1.0
Content-Type: multipart/alternative;
      boundary="----=_NextPart_000_0003_01C58110.2338C4F0"
X-Priority: 3 (Normal)
Importance: Normal

This is a multi-part message in MIME format.

------=_NextPart_000_0003_01C58110.2338C4F0
Content-Type: text/plain;
      charset="us-ascii"
Content-Transfer-Encoding: 7bit

This is some text


------=_NextPart_000_0003_01C58110.2338C4F0
Content-Type: text/html;
      charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>

<head>

[[[..........A BUNCH OF HTML I AM STRIPPING OUT........]]]]]

10.0pt;font-family:Arial;color:blue'>This is some text</span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0003_01C58110.2338C4F0--


=========END PASTE=============================
dereshCommented:
i just use this header:

$header .= "Content-Type: text/html; charset=win-1250\r\n";


and it works in all clients that i have tried (and google webmail)

i think your problem was that you have  put

$headers  = "MIME-Version: 1.0\r\n";

and later your body mail wasn't a vaild MIME mail so some MUA bypassed this and some haven't :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hujiCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: deresh

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Huji
EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.