Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use the <br>tag in email content? [duplicate]

Tags:

html

php

    $to      = "[email protected]" ;

$subject = "Instant estimate message";


$message ="<b>Name: </b>".$name."\r\n"."<b>Email: </b>".$email."\r\n"."<b>Mobile: </b>".$mobile."\r\n"."<b>Message: </b>".$message1;

$from = $email;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "From:".$from;

mail($to,$subject,$message,$headers);

i cant get the details in newline, even i have added

$message ="<b>Name: </b>".$name."</br>"."<b>Email: </b>".$email."</br>"."<b>Mobile: </b>".$mobile."</br>"."<b>Message: </b>".$message1;

So tell me how to fix this.

like image 326
Keerthi Avatar asked Dec 14 '22 22:12

Keerthi


2 Answers

The problem is your <br /> tag. Be careful where to put the slash. Not before br but after it. Rikesh told you the correct way!

like image 161
Andi Avatar answered Dec 17 '22 12:12

Andi


use <br/> tag instead of "\r\n". I think it may help you.

like image 39
Prashant Vardhan Singh Avatar answered Dec 17 '22 12:12

Prashant Vardhan Singh