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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Html Mail issue 1

Status
Not open for further replies.

elf1

Technical User
Jun 6, 2001
43
US
Greetings,

I am having issues with the mail() function when sending an html formatted e-mail.

The code sending the message is:
"
$subject = "New Equipment Posting on XXXXXX.org Website";
$message = '<html><body>Hello, <p>A new item has been added for Sale on the XXXXXXXX.org website. You can view the item <a href=[0].'>here</a>. <p> Thank You</body></html>';
$newLine = "\r\n";

$headers = "MIME-Version: 1.0" . $newLine;
$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
$headers .=" TO: XXXXXXXXXX.org <XXXXXX@XXXXX.org>" . $newLine;
$headers .= "From: XXXXXXXX.org <XXXXXX@XXXXX.org>" . $newLine;

mail($to, $subject, $message, $headers);
header("Location: thankyou.php");
"

When I receive this e-mail (Using Thunderbird, Hostway SMTP) it comes in formatted correctly.
I also receive this e-mail to my gmail account correctly.
Some recipients are receiving it with no From, and not as html, but text with all the html tags.

I know there is an issue with my header, but I have been unable to discover what it is.

Thanks!
Rick
 
some clients cannot or do not read html. they will either look for a text multipart or just display the html. look at multipart emails to solve this problem.

I see nothing wrong with you From header although I know that some servers to baulk at the address <name> notation. I would also put the email headers (to and from) before the message headers as different MTA's will doubtless act differently.

but most of all, i'd recommend using phpmailer for this. it will solve all of your problems.
 
You can also add the from as an actual variable and then put it in the proper position in the mail () function... The header function doesn't always work correctly...

MCP ACA-I CTP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top