By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

Losing random characters in HTML email

P: n/a
,hj

From: ",hj" <we*******@mail.com>
Subject: Losing random characters in HTML email
Date: 28 November 2003 17:21

I've narrowed down my code as much as I can so that I can show you this bug.
The reason the a's are there and not removed is because if I remove them the
problem doesn't show itself. It seems that there is a pattern and the nth
character does not show. Weird stuff.
<?php
$content = '

<html>
<head>
<title>aaaaaaa :: title</title>
<META http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META name="Description" content="aaaaaar -
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaae.">
<META name="Keywords"
content="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaae">
<LINK rel="stylesheet"
href="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa" type="text/css">
</head>
<body>
contentdfdfdf
</body>
</html>';
$header = "Return-Path: fa****@aaaaaaa.com\r\n";
$header .= "From: Gamblar <ac******@aaaaaaa.com>\r\n";
$header .= "Content-Type: text/html;
charset=iso-8859-1;\r\n\r\n";

mail("we*******@aaaaaaaaaaa.com","ac******@aaaaaaa .com",$content,$header);
?>

Try that code, changing the first mail attribute to your email address. You
should get this output: "contentdfdfdf </html".

Does anyone know what I'm doing wrong? Bug, perhaps?

Thanks in advance,

Keiron


Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
,hj wrote:
I've narrowed down my code as much as I can so that I can show you this bug.
The reason the a's are there and not removed is because if I remove them the
problem doesn't show itself. It seems that there is a pattern and the nth
character does not show. Weird stuff.
[big snip]
<body>
contentdfdfdf
</body>
[...]
mail("we*******@aaaaaaaaaaa.com","ac******@aaaaaaa .com",$content,$header);
?>

Try that code, changing the first mail attribute to your email address. You
should get this output: "contentdfdfdf </html".
I get the full HTML (without headers).
When I try to view that HTML in my browser I see "contentdfdfdf", but I
didn't look at the source then
Does anyone know what I'm doing wrong? Bug, perhaps?


Well ... "contentdfdfdf" *is* the body of that HTML.
What did you expect to see?
--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
--= Size below 10K =--
Jul 17 '05 #2

P: n/a

",hj" <we*******@mail.com> wrote in message
news:bq**********@titan.btinternet.com...

From: ",hj" <we*******@mail.com>
Subject: Losing random characters in HTML email
Date: 28 November 2003 17:21

I've narrowed down my code as much as I can so that I can show you this bug. The reason the a's are there and not removed is because if I remove them the problem doesn't show itself. It seems that there is a pattern and the nth
character does not show. Weird stuff.
<?php
$content = '

<html>
<head>
<title>aaaaaaa :: title</title>
<META http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META name="Description" content="aaaaaar -
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaae.">
<META name="Keywords"
content="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaae">
<LINK rel="stylesheet"
href="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaa" type="text/css"> </head>
<body>
contentdfdfdf
</body>
</html>';
$header = "Return-Path: fa****@aaaaaaa.com\r\n";
$header .= "From: Gamblar <ac******@aaaaaaa.com>\r\n";
$header .= "Content-Type: text/html;
charset=iso-8859-1;\r\n\r\n";

mail("we*******@aaaaaaaaaaa.com","ac******@aaaaaaa .com",$content,$header);
?>

Try that code, changing the first mail attribute to your email address. You should get this output: "contentdfdfdf </html".

Does anyone know what I'm doing wrong? Bug, perhaps?

Thanks in advance,

Keiron


You wouldn't happen to be using PHP version 4.3.3 would you?

I had problems with random characters disappearing when using the mail()
function to send MIME encoded emails. This mail() bug has been reported at
the www.php.net website, it seems to have been fixed in 4.3.4.
Jul 17 '05 #3

P: n/a
Richard Hockey wrote:
You wouldn't happen to be using PHP version 4.3.3 would you?

I had problems with random characters disappearing when using the mail()
function to send MIME encoded emails. This mail() bug has been reported at
the www.php.net website, it seems to have been fixed in 4.3.4.


http://bugs.php.net/bug.php?id=26061

Seems it only happens in Windows and with php 4.3.3
I have php 4.3.3 but not Windows; no wonder I couldn't reproduce the
error!
--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
--= Size below 10K =--
Jul 17 '05 #4

P: n/a
Hello,

On 11/28/2003 05:21 PM, ,hj wrote:
Try that code, changing the first mail attribute to your email address. You
should get this output: "contentdfdfdf </html".

Does anyone know what I'm doing wrong? Bug, perhaps?


First, you should never send HTML only (Content-type: text/html)
messages. Many spam filters will discard your message. You should at
least have an alternative text part (text/plain). For that you should be
sending multipart/alternative messages, that include both the text and
HTML parts and let the end user program read what it can display better.

Second, you should always use an encoding method if you may have 8 bit
characters in your messages. For plain text or HTML, quoted-printable is
more appropriate.

Third, the mail() function has several bugs that is often better to
avoid it.

To solve any of these problems, you may want to try this class that
comes with sub-classes for deliverying messages via mail() but also via
sendmail/qmail/postfix/etc programs or even via SMTP.

http://www.phpclasses.org/mimemessage
--

Regards,
Manuel Lemos

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

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.