Link to home
Start Free TrialLog in
Avatar of bliesveld
bliesveld

asked on

PHP e-mail question?

I want to send a multilane email that is generated from variables I collect on another page.

I am using:

$text = 'WEB INFO REQUEST 'BY '.$name . 'PRODUCT: '.$prod. ' ID CODE: '.$id_code.'******** END OF E-MAIL *********';

mail('xxxxxxx@yahoo.com','WEB INFO REQUEST',$text,"From: $name <$email>");

I want to separate this content on new lines?

Thanks
Avatar of Umesh
Umesh
Flag of India image

try this..

$text = '\n WEB INFO REQUEST 'BY '.$name . '\n PRODUCT: '.$prod. ' \nID CODE: '.$id_code.'\n******** END OF E-MAIL *********';


check out here for more..
http://us2.php.net/function.mail
ASKER CERTIFIED SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

yeah am agree with Squinky , it is better if you go for phpmailer.sourceforge.net.
I just spotted a problem with ushastry's example - it's using single quotes, so escaped chars won't get interpolated, i.e. \n will not be converted to a newline. Using double quotes, you can also put vars within the string anyway:

$text = "\nWEB INFO REQUEST BY $name\nPRODUCT: $prod\nID CODE: $id_code\n******** END OF E-MAIL *********";

I think that for ugly historical reasons, emails are meant to use CRLF DOS-style line breaks. PHPMailer deals with all that for you though.