Page 1 of 1

Carriage return problem inside a email message.

Posted: Fri Jan 10, 2003 5:58 pm
by Genteel Beaux
Ok, this seems like a simple problem, but I am stumped. Before you flame me, I went to places like php.net and did a search on several popular php website as well as places like google.

I can't get messages to move to the next line where I want them to.

The code is something like this.

Code: Select all

<?php

$member_name = mysql_result($result,0,0);
$password = mysql_result($result,0,1);
$email_address = mysql_result($result,0,2);
$subject = 'My Subject';
$message = 'You recently requested to have your information sent to you.\r\n' .
'Per your request, your information is provided below.\r\n' .
'Member Name:  ' . $member_name . '\r\n' .
'Password:  ' . $password .  '\r\n' .
'You may login at http://www.mylocalhost.com';

mail($email_address, $subject, $message);


?>
I read somewhere that \r\n would take care of this, but it is not working.
The email is being sent to my hotmail account. When I open up my hotmail account, it looks similar to this:

You recently requested to have your information sent to you.\r\nPer your
request, your information is provided below.\r\nMember Name: Bubba\r\nPassword: slick\r\nYou may login at http://www.mylocalhost.com.
So what did I miss?

Posted: Fri Jan 10, 2003 6:05 pm
by volka
replacement of \r and/or \n only occurs in double-quoted strings
http://www.php.net/manual/en/language.types.string.php
'\r\n' :arrow: "\r\n"

Posted: Fri Jan 10, 2003 6:27 pm
by Genteel Beaux
It worked!!! I can't believe I spent hours on that.

Good looking out volka.