html in email body?

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
dgarrett
Forum Newbie
Posts: 20
Joined: Sun Sep 15, 2002 8:54 pm
Location: CA, UT

html in email body?

Post by dgarrett »

I'm back with some of the same code, now I need to format the body of the email a little currently the code rightfully outputs one string of text for the body. I'd like to have line breaks inbetween sections. I tried adding <br> into the body variable it just output <br> I tried 'br' and it failed and I also tried \n supposedly a line break but it did not work. The code is below, I'm sure it is a simple solution, just one I am over looking, thanks dustin.

Code: Select all

&lt;?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Mica";
$ToSubject = "New Fan Club Member";

$EmailBody = "Sent By: $Name Senders Email: $Email Address: $Address City: $City State: $State Zip: $Zip Sex: $Sex Shirt Size: $Size Birthday: $Birthday";

//$EmailFooter="This message was sent by: $FirstName  If you feel that you
//recieved this e-mail by accident please contact us at http://www.whitedotgroup.com";

//$Message = $EmailBody
//.$EmailFooter;

if ( mail($ToEmail, $ToSubject, $EmailBody, "From: ".$Name." &lt;".$Email."&gt;") ) {
    echo 'I worked';
} else {
    echo 'I did not work';
}
?&gt;
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

dgarrett
Forum Newbie
Posts: 20
Joined: Sun Sep 15, 2002 8:54 pm
Location: CA, UT

Post by dgarrett »

Thanks,

using \r\n works don't know why, but it does in the book it says \n but if it works it works.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

\r\n is a Windows thing - for some reason just a newline isn't enough (as you found).

Mac
Post Reply