Newlines in message

the mail() function

Moderators: macek, egami, gesf

rob
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Dec 31, 2002 6:50 pm

Newlines in message

Postby rob » Tue Dec 31, 2002 6:58 pm

I'm new at PHP so probably missing something simple.

I have successfully created a script that gathers info from fields on a web page, puts them in an e-mail, and sends it to a specified address. However, I have tried to format the message with newlines to make it more readable and it always come back as one long line. I've tried \r\n and \n but to no avail. Is there something else I should be using or is there some setting that makes this work?

Here is the code that builds the message:

$message = "Info\r\n";
foreach($PARAMS as $key=>$value)
{
if (substr($key,0,7) != "mailer_")
$message .= strtoupper($key).": ".$value."\r\n";
}

Thanks for the help.

serg_dz
New php-forum User
New php-forum User
Posts: 13
Joined: Thu Oct 10, 2002 10:37 pm
Location: Ukraine

Postby serg_dz » Wed Jan 01, 2003 11:42 pm

You are using M$ mailer to receive your messages?
If you want a correctness do not use M$ at all. Or try another mailer! The bat, for example.

I'm not shure this is an answer to your problem, but it could be.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Thu Jan 02, 2003 12:04 am

$message=nl2br($message) // for html messages

rob
New php-forum User
New php-forum User
Posts: 2
Joined: Tue Dec 31, 2002 6:50 pm

Postby rob » Thu Jan 02, 2003 7:31 pm

Thanks, the nl2br() did it. I didn't realize I was sending an html message.


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 2 guests