I've written a system that upon certain events sends an email to people. The email is in html format and the headers I'm using are:
$headers = "From: me@company.com\r\n";
$headers .= "Content-type: text/html\r\n";
I then go on to form the email as a web page. I have verified that I'm using <html><head></head><body></body></html> tags. In the head are a few local style definitions. The body consists of straight text and an href link.
The emails always get sent, but occasionally there is a dropped byte. Just 1. One time a letter in the middle of the link path was dropped. The issue I've seen most is the closing tag > of the </html> was dropped.
This has been reported from users using Outlook 2003 on WinXP SP-1 and
Outlook 2002 on WinXP SP-1.
Has anyone seen this? Any ideas?
mail() dropped byte issue
Moderator: General Moderators
[/quote]<HTML><head><style type="text/css">
td { font-family:verdana,arial; font-weight:normal; font-size:10pt; color: black; }
font { font-family:verdana,arial; font-weight:normal; font-size:10pt; color:black; }
</style></head><BODY bgcolor="#ffffff">
<FONT><BR>Fake Test<BR>Priority: Moderate<BR><BR><a href='http://machine/CTS/swedit?num=XXS-45'>View CR</a><BR><BR>Reported Problem:<BR>fake problem</FONT></BODY></HTML>
Sorry:
The email is pulled from a database and stored as $to. The headers I'm using were posted in the first message and are stored in $headers.
feyd | Please use
Code: Select all
$subject = "CR Opened";
$link = sprintf("http://%s/CTS/swedit.php?num=$num", $_SERVER['SERVER_NAME']);
$message = "<HTML><head><style type="text/css">\n";
$message .= "td { font-family:verdana,arial; font-weight:normal; font-size:10pt; color: black; }\n";
$message .= "font { font-family:verdana,arial; font-weight:normal; font-size:10pt; color:black; }\n";
$message .= "</style></head><BODY bgcolor="#ffffff">\n";
$message .= "<FONT><BR>";
$message.= "$prod_desc<BR>Priority: $priority<BR><BR><a href='$link'>View CR</a><BR><BR>Reported Problem:<BR>$reported_problem</FONT>";
$message .= "</BODY></HTML>";
$status = mail($to, $subject, $message, $headers);feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]-
Black Unicorn
- Forum Commoner
- Posts: 48
- Joined: Mon Jun 16, 2003 9:19 am
- Location: United Kingdom
I had this problem recently, but didn't found a satisfactory solution.
The problem wasn't there using my web-based mail, and as far as I know and care it's an M$ bug / strategy. Maybe put some M$ friendly headers in your mail and the problem goes away? I didn't want to go THAT far myself.
My solution was to add some junk after the closing HTML tag. Like ...
</body>
</html>
>
---+ boundary whatever ---!
It seemed to compensate for the final > in the final tag. Also, I found the boundary would display on Outlook Express (didn't try Outlook, but assume the same problem would be there) until I simply added the extra >.
If a reason for this bug is ever to be found/admitted, I would be itching to hear it.
Best wishes,
H
The problem wasn't there using my web-based mail, and as far as I know and care it's an M$ bug / strategy. Maybe put some M$ friendly headers in your mail and the problem goes away? I didn't want to go THAT far myself.
My solution was to add some junk after the closing HTML tag. Like ...
</body>
</html>
>
---+ boundary whatever ---!
It seemed to compensate for the final > in the final tag. Also, I found the boundary would display on Outlook Express (didn't try Outlook, but assume the same problem would be there) until I simply added the extra >.
If a reason for this bug is ever to be found/admitted, I would be itching to hear it.
Best wishes,
H
There is another PHP system that I wrote where I don't use html tags at all in the email. There are links in those emails but it's utilizing the assumption that the email client will recognize http:// strings and make them a link automatically. That system has been used for years and I've never heard of any bytes missing in those emails. I'm starting to think that it's something to do with the 'Content-type: text/html;' definition. Thanks for the input Black Unicorn, I'll let you know if I ever find a fix.