frequently ask ? : Computers : Programming : Languages : PHP : Common Problems : Email

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 12 people (33%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I send a multi-line (character returns etc..) email message

Dec 11th, 2001 21:54
Yasser Masood, Neil Hartley,


It's relatively easy to do. Just create a variable ($message or 
whatever suites you) to use as a container for the text that you want 
to email to the user. Then format the text using some text editor like 
http://Textpad.com and create your text message.
In your script use the mail() function to send out the mailing and 
format $message this way:
$message = "Begin first line of your message here.
Second line may follow like this and you can break the line
normally just like this. No need to add and additional tags.";
Your message will appear like this in the body area of the email:
-----
Begin first line of your message here.
Second line may follow like this and you can break the line
normally just like this. No need to add any additional tags.
-----
There are other ways to do this also but this works fine. You may try 
including a file in the $message variable using the include() function 
however, I have not tried this yet.