Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send a HTML page using mail()

Status
Not open for further replies.

k23

Programmer
Aug 13, 2004
10
HK
Dear all,

I got a problem when sending a html page using mail().

$to .= 'info@abc.com';
$subject = 'Mail from Master';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; harset=big5' . "\r\n";
$headers .= 'From: Info <info@def.com>' . "\r\n";
mail($to, $subject, $mail_message, $headers);

where $mail_message is the HTML source code.

But when i receive the email, it shows the html source code instead of display the html page. I'm sure $mail_message contains complete html source code.

What problem is it? Is there anything missing?
Thanks for your help.

k23
 
Hi K23,

Use this for the headers:

//add From: header
$headers = "From: info@def.com\r\n";

//specify MIME version 1.0
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";


Works fine with me..

Greetz.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top