Skip to content Skip to sidebar Skip to footer

Line Break Html Email

new to the forum and trying my hand at some coding to help out a friend who cant seem to get this right.. with that being said, i was originally having issues with the contact form

Solution 1:

You could pre-format the mail body using standard line breaks within double quotes like this:

$Body = "
    Name: {$Name}
    Tel: {$Tel}
    Email: {$Email}
    Message: {$Message}";

To achive the double line-height you insert another return between the lines:

$Body = "
    Name: {$Name}

    Tel: {$Tel}

    Email: {$Email}

    Message: {$Message}";

Solution 2:

thanks for all your help guys! i got it to work, i added "\n" into the code and it works perfectly, i just need it to seperate the text so that it is easier to read when the email comes through from the site, thanks again really helped me out with this!

Solution 3:

add <br/> tag to add new line space with your variables like this

$Body = "";
$Body .= "Name: ";
$Body .= $Name.'<br/>';

and wherever else you want to add new line space for this your must be in HTML form because there are two type of email html and richtext. takecare of that also.

Solution 4:

Not sure if this works but if it's HTML email, this should work.

$Body .= '<html><body>';
$Body .= "Name: ";
$Body .= $Name;
$Body .= "<br>";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "<br>";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "<br>";
$Body .= "Message: ";
$Body .= wordwrap($Message, 50);
$Body .= '</body></html>';

The message may or may not work. Don't get your hopes up to high on that part.

Solution 5:

add <br/> tag to add new line space with your variables like this

$Body  = "Name   : "$Name    ."<br/>";
$Body .= "Tel    : "$Tel     ."<br/>";
$Body .= "Email  : "$Email   ."<br/>";
$Body .= "Message: "$Message ."<br/>";

Post a Comment for "Line Break Html Email"