strange one ">" appears in mail text

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
andykent
Forum Newbie
Posts: 4
Joined: Wed May 07, 2003 7:25 pm

strange one ">" appears in mail text

Post by andykent »

Strange one this - we build up the body of a text message in php and when the email arrives, a ">" appears before one of the lines in the body - there is literally nowhere in the code that this appears - can't think why - shared with colleagues - has anyone come across this or know why this could be happening
sleepingdanny
Forum Newbie
Posts: 12
Joined: Thu Mar 20, 2003 4:27 am
Location: Israel

Post by sleepingdanny »

Why don't you show us the code so we can help you
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Is it an HTML e-mail? If it is you may have something like:

Code: Select all

<p>message</p>>
with an extra > being printed because there's an additional one in the code.

Mac
andykent
Forum Newbie
Posts: 4
Joined: Wed May 07, 2003 7:25 pm

here is the code

Post by andykent »

$body = "Hi " . $firstname . " \n\n"
. "You are the latest person to join our adventures in the forest! It is so awesome to have you with us. All the bugs love receiving mail from the big outside world.\n\n"

. "You are going to really enjoy being part of the Buzz & Poppy club - its lots of fun, there's lots to do, and competitions with heaps of prizes to be won.\n\n"

. "As a member you need to know your membership number so you can get your special member's discount on products. Your number is BP". $memberid ."\n\n";

if ($country == "NZ") {
$body=$body. "To get you started, you can buy your membership pack which includes a soft toy, a colouring book and a video of 8 wild forest adventures! There is even an official membership certificate officially signed by Buzz & Poppy!\n" . "Check it out at http://www.buzz-poppy.com/news/memberpack.htm\n\n" . "It is just $24.99! This is a very low price for club members only who live in New Zealand! Ask Mum or Dad to print out the order form from:\n" . "www.buzz-poppy.com/news/orderform.htm \n";
}
$body = $body . "From all the bugs here - thanks for joining our club!\n\n"

. "See ya!!\n\n"


the > appears before "From all the bugs here" - so not sure where this comes from!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Does the > appear if you do:

Code: Select all

echo $body;
after the variable has been built up?

Mac
andykent
Forum Newbie
Posts: 4
Joined: Wed May 07, 2003 7:25 pm

delayed response!

Post by andykent »

this is difficult to do - this page simply emails the user

there is no screen output for this one

I am sure this must be a bug - I managed to get this working for a while - then added another PERFECTLY valid statement to just add another line in and this made the > reappear again

Believe me I have checked EVERY character, tried options like /r/n as well as just /n for new line - I have added spaces, taken out various characters to try to highlight where the problem arises!

Obviously emailing myself $body gives the same > error!

Any other ideas?

Thanks
kenrbnsn
Forum Newbie
Posts: 13
Joined: Tue Jul 01, 2003 3:34 pm
Location: Hillsborough, NJ USA

You're seeing an OLD bug in UNIX email processing...

Post by kenrbnsn »

The code you have is fine. There's nothing you can do about it. For some reason most UNIX based email processors (sendmail, etc) think that a line starting with "From" is part of the message header and will put the ">" in front of the word.

AFAIK there is nothing you can do to prevent it from happening. :(
andykent
Forum Newbie
Posts: 4
Joined: Wed May 07, 2003 7:25 pm

thanks!

Post by andykent »

thats really helpful - thank you

at least I can change the word to see what happens!

:)

Andy
Post Reply