Jump to content


Photo

Problem with new line (\n) in plain text email on MAC


  • Please log in to reply
5 replies to this topic

#1 jcavard

jcavard
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 24 February 2006 - 06:32 PM

Hi!

I use PHPMailer to send mail. I use \n as line carriage (new line) on a PC it works great but on a MAC it seems like \n doesnt work... it print all the text on the same line...

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 24 February 2006 - 06:36 PM

[!--quoteo(post=349095:date=Feb 24 2006, 01:32 PM:name=jcavard)--][div class=\'quotetop\']QUOTE(jcavard @ Feb 24 2006, 01:32 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi!

I use PHPMailer to send mail. I use \n as line carriage (new line) on a PC it works great but on a MAC it seems like \n doesnt work... it print all the text on the same line...
[/quote]

try using "\r\n" instead. typically, it's windows machines that need the \r, but it's worth a shot.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 jcavard

jcavard
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 27 February 2006 - 07:29 PM

anyone has ever encountered this before????

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 27 February 2006 - 07:54 PM

Newline codes::

Unix/linux    \n
Mac           \r
Windows       \r\n

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 27 February 2006 - 07:55 PM

This is probably because of the different types of line breaks on the different OSes.

Here's how the line breaks work in

Unix: \n
Mac: \r
Windows: \n\r

Use \n\r to be safe :)

edit: Barand's too quick ;)

http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#6 jcavard

jcavard
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 27 February 2006 - 08:44 PM

thank you!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users