Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Newlines in message

the mail() function

Moderators: macek, egami, gesf

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.
rob
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Dec 31, 2002 6:50 pm

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.
serg_dz
New php-forum User
New php-forum User
 
Posts: 13
Joined: Thu Oct 10, 2002 10:37 pm
Location: Ukraine

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

$message=nl2br($message) // for html messages
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

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

Thanks, the nl2br() did it. I didn't realize I was sending an html message.
rob
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Dec 31, 2002 6:50 pm


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron