Page 1 of 1

html in email body?

Posted: Fri Sep 27, 2002 5:54 pm
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;

Posted: Fri Sep 27, 2002 6:12 pm
by volka

Posted: Fri Sep 27, 2002 6:34 pm
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.

Posted: Sat Sep 28, 2002 5:05 am
by twigletmac
\r\n is a Windows thing - for some reason just a newline isn't enough (as you found).

Mac