Page 1 of 1

PHP mail formating

Posted: Thu Jun 23, 2005 3:25 am
by srirams
All,

I want the message below to be email with a line feed something like this.
Name:
Problem with :
Problem :

Currently in the mail everything is getting displayed in 1 line together.
Can some one help.
{
$to = 'sriram.s@db.com';
$subject = 'Problem with '. $sysname ;
$message = 'Name :'. $name . ' Problem with :' . $sysname .' Problem Details :' . $problem . ' Phone Num :' . $phnum;
$headers = 'From: sriram_s_98@yahoo.com';

mail($to, $subject, $message, $headers);

Posted: Thu Jun 23, 2005 3:29 am
by method_man
add
break; when u want it to go a line down

Posted: Thu Jun 23, 2005 3:30 am
by srirams
Hi,

Could you please show me in the code where I should add the break as an example.

Posted: Thu Jun 23, 2005 3:33 am
by shailendra
HI,

Try the following code, add <br> in your code;


<?
$to = 'sriram.s@db.com';
$subject = 'Problem with '. $sysname;
$message = 'Name :'. $name . '<br><br> Problem with :' . $sysname .'<br><br> Problem Details :' . $problem . '<br><br> Phone Num :' . $phnum;
$headers = 'From: sriram_s_98@yahoo.com';

mail($to, $subject, $message, $headers);

?>


Thanks

Shailendra

Posted: Thu Jun 23, 2005 3:33 am
by method_man
{
$to = 'sriram.s@db.com';
$subject = 'Problem with '. $sysname ;
$message = 'Name :'. $name .
break;
' Problem with :' . $sysname .
break;
' Problem Details :' . $problem .
break;
' Phone Num :' . $phnum;
$headers = 'From: sriram_s_98@yahoo.com';

mail($to, $subject, $message, $headers);

i think that is how you would do it :D

p.s. this is my 200th post :D

Posted: Thu Jun 23, 2005 3:35 am
by method_man
actually <br> is for html
break; is for php

Posted: Thu Jun 23, 2005 3:35 am
by srirams
Shailendra, I already tried <br>, but it was displaying the br as well.
I will break and see.

Thanks mat and congrats on your 200.
Keep it up.

Sriram

Posted: Thu Jun 23, 2005 3:36 am
by shailendra
Hi,

yes <br> works, try it.

Posted: Thu Jun 23, 2005 3:37 am
by shailendra
ok,
Sorry mat i think you are correct

Thanks

Posted: Thu Jun 23, 2005 3:37 am
by method_man
it displays the <br> because it is not a command

Posted: Thu Jun 23, 2005 4:13 am
by srirams
Guys break gave me an error.
"\n" worked finally.
Thanks for the help and effort.

Good luck