PHP mail formating

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
srirams
Forum Commoner
Posts: 36
Joined: Wed May 25, 2005 8:57 am
Location: India
Contact:

PHP mail formating

Post 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);
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

add
break; when u want it to go a line down
srirams
Forum Commoner
Posts: 36
Joined: Wed May 25, 2005 8:57 am
Location: India
Contact:

Post by srirams »

Hi,

Could you please show me in the code where I should add the break as an example.
shailendra
Forum Newbie
Posts: 13
Joined: Mon Jun 20, 2005 12:20 am
Location: INDIA
Contact:

Post 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
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post 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
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

actually <br> is for html
break; is for php
srirams
Forum Commoner
Posts: 36
Joined: Wed May 25, 2005 8:57 am
Location: India
Contact:

Post 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
shailendra
Forum Newbie
Posts: 13
Joined: Mon Jun 20, 2005 12:20 am
Location: INDIA
Contact:

Post by shailendra »

Hi,

yes <br> works, try it.
shailendra
Forum Newbie
Posts: 13
Joined: Mon Jun 20, 2005 12:20 am
Location: INDIA
Contact:

Post by shailendra »

ok,
Sorry mat i think you are correct

Thanks
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

Post by method_man »

it displays the <br> because it is not a command
srirams
Forum Commoner
Posts: 36
Joined: Wed May 25, 2005 8:57 am
Location: India
Contact:

Post by srirams »

Guys break gave me an error.
"\n" worked finally.
Thanks for the help and effort.

Good luck
Post Reply