?
Solved

PHP e-mail question?

Posted on 2004-09-06
4
Medium Priority
?
207 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:bliesveld
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:Umesh
ID: 11994169
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
0
 
LVL 25

Accepted Solution

by:
Marcus Bointon earned 200 total points
ID: 11995030
ushastry is right - you just need line breaks. I'd still recommend that you use PHPMailer (phpmailer.sourceforge.net). It's a whole load easier and more reliable than mail() alone.
0
 
LVL 26

Expert Comment

by:Umesh
ID: 11995057

yeah am agree with Squinky , it is better if you go for phpmailer.sourceforge.net.
0
 
LVL 25

Expert Comment

by:Marcus Bointon
ID: 11995117
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.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question