Re: [PHP] Line breaks in mail function?

2005-11-06 Thread Murray @ PlanetThoughtful

Jasper Bryant-Greene wrote:


On Mon, 2005-11-07 at 12:20 +1000, Murray @ PlanetThoughtful wrote:
 


Example code:

   $body = 'From: ' . $name . '\r\n\r\n';
   $body .= 'Email:' . $email . '\r\n\r\n';
   $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
   $body .= 'Feedback:\r\n\r\n';
   $body .= $feedback;
   mail("[EMAIL PROTECTED]", "Feedback", $body, "From: 
$email\r\nReply-To: $email\r\nX-Mailer: PHP/" . phpversion());


As I said above, I've also tried using "\n\n" instead of "\r\n\r\n".

Can anyone give me some advive on how to get the linebreak characters 
interpreted as linebreaks?
   



Use double quotes around the parts that have \r and \n characters if you
want them to be interpreted.

 


Ah, damn you Jasper, I should have noticed that myself.

Don't you hate it when you've been staring at code too long to notice 
the obvious?


Thank you!

Much warmth,

Murray

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Line breaks in mail function?

2005-11-06 Thread Richard Leclair
Hi Murray,

Try doing something like this:

---
$body = "From: $name
Email: $email
IP Address: $_SERVER['REMOTE_ADDR']

Feedback:

$feedback
";

$fromaddr = "$email
Reply-To: $email
X-Mailer: PHP/" . phpversion();

mail("[EMAIL PROTECTED]", "Feedback", $body, $fromaddr);
---

I haven't tested this 'actual' piece of code, but I've used similar in other
emailing scripts.

Regards,
Richie !

> -Original Message-
> From: Murray @ PlanetThoughtful [mailto:[EMAIL PROTECTED]
> Sent: Monday, 7 November 2005 10:21 am
> To: php-general@lists.php.net
> Subject: [PHP] Line breaks in mail function?
> 
> Hi All,
> 
> I'm building a site on a new web host and am currently working on
> feedback forms.
> 
> I'm using the mail() function to send the feedback to the destination
> mail account, and I'm having problems getting the body of the email to
> line break.
> 
> I've tried constructing the body with both "\n\n" and "\r\n\r\n"
> terminating lines where I want line breaks to appear, but both return an
> email with the body in one long string showing the actual "\n\n" or
> "\r\n\r\n" characters, as opposed to interpreting them as line breaks.
> 
> Example code:
> 
> $body = 'From: ' . $name . '\r\n\r\n';
> $body .= 'Email:' . $email . '\r\n\r\n';
> $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
> $body .= 'Feedback:\r\n\r\n';
> $body .= $feedback;
> mail("[EMAIL PROTECTED]", "Feedback", $body, "From:
> $email\r\nReply-To: $email\r\nX-Mailer: PHP/" . phpversion());
> 
> As I said above, I've also tried using "\n\n" instead of "\r\n\r\n".
> 
> Can anyone give me some advive on how to get the linebreak characters
> interpreted as linebreaks?
> 
> Many thanks and much warmth,
> 
> Murray
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Line breaks in mail function?

2005-11-06 Thread Jasper Bryant-Greene
On Mon, 2005-11-07 at 12:20 +1000, Murray @ PlanetThoughtful wrote:
> Example code:
> 
> $body = 'From: ' . $name . '\r\n\r\n';
> $body .= 'Email:' . $email . '\r\n\r\n';
> $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
> $body .= 'Feedback:\r\n\r\n';
> $body .= $feedback;
> mail("[EMAIL PROTECTED]", "Feedback", $body, "From: 
> $email\r\nReply-To: $email\r\nX-Mailer: PHP/" . phpversion());
> 
> As I said above, I've also tried using "\n\n" instead of "\r\n\r\n".
> 
> Can anyone give me some advive on how to get the linebreak characters 
> interpreted as linebreaks?

Use double quotes around the parts that have \r and \n characters if you
want them to be interpreted.

-- 
Jasper Bryant-Greene
General Manager
Album Limited

e: [EMAIL PROTECTED]
w: http://www.album.co.nz/
b: http://jbg.name/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php