Page 1 of 1

Carriage return problem inside a email message.

Posted: Tue Sep 30, 2008 1:01 pm
by ajarantes
The e-mail I'm sending insists in not recognize the line-feed/carriage-return "\n\r". I send it to Gmail, Yahoo, Hotmail and the text always arrive as one single paragraph. The "\n\r" don't show up but also don't create new lines or paragraphs.

Only when I send to one of my own e-mail addresses and open with "squirrelMail" is that it opens correctly. But when I download the same e-mail to my computer and open with Thunderbird, it goes back to one only paragraph.

Do you have any idea what else I can try? Thanks.

Here is the code:

Code: Select all

[color=#0000BF]$to = $mail;
$subject = $subj;
$message = "Dear $name,\r\r\n\n" .
           "This e-mail was sent to you to confirm your registration with KIMIMI.\r\r\n\n" .
           "You have 24 hours to proceed with this confirmation or your registration will be lost." .
           "To finalize the process and start using all the wonderful features of KIMIMI, " . 
           "clik on the link below or, if you do not allow HTML in the e-mails " .
           "you receive, copy and paste the link to your browser address area \r\r\n\n" .
           "http://www.kimimi.net/confreg.php?id=$confstring\r\r\n\n" .
           "If you have any problems, please contact us.\r\r\n\n" . 
           "Welcome to KIMIMI\r\nThe Kimimi Team\r\nwww.kimimi.net";
$headers = "From: info@kimimi.net\r\n" ;
$headers .= "To: $email <".$email.">\r\n" ;
$headers .= "Reply-To: info@kimimi.net\r\n" ;
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$mail = mail($to, $subject, $message, $headers);[/color]

Re: Carriage return problem inside a email message.

Posted: Tue Sep 30, 2008 1:10 pm
by RobertGonzalez
try using \r\n\r\n instead of \r\r\n\n. Or try using just one of them.

What platform is your server?

Re: Carriage return problem inside a email message.

Posted: Tue Sep 30, 2008 1:54 pm
by ajarantes
Everah,

Thank you for answering so fast...

I tried all options, with \r\n\r\n, \r\r, and \n\n and still no success.

the server in my hosting company is a Linux/Apache.

Cheers,
Alex

Re: Carriage return problem inside a email message.

Posted: Tue Sep 30, 2008 2:32 pm
by RobertGonzalez
Have you tried using heredoc syntax for the text? Or perhaps string literals with concatenated variables? It would certainly remove the need for using ascii characters in the body.

Or maybe even a template parser?

Re: Carriage return problem inside a email message.

Posted: Tue Sep 30, 2008 2:46 pm
by ajarantes
Everah and everyone else.

I just found the problem with the help of another expert...

The problem was the Content-type.

Once I changed it to "text/plain" the problem was gone.

I hope it help others.

Thank you very much!!!!

Re: Carriage return problem inside a email message.

Posted: Tue Sep 30, 2008 2:56 pm
by RobertGonzalez
Sorry about that. It was right in your code and I didn't even see it.

Glad you got it sorted though.

Re: Carriage return problem inside a email message.

Posted: Fri Oct 03, 2008 1:08 pm
by amera
Thank you for your kindness
I will to learn more about this topic .