Reputation: 13189
I am trying to make a breakline on PHPMailer on the message of my email.
Here is how I do it:
$message = '';
$message .= 'Line 1' . "\r\n";
$message .= 'Line 2' . "\r\n";
And I add it on PHPMailer as follows:
$mail->Body = $message;
where $mail
is the instance of PHPMailer but when I send the email the message does not respect any breakline.
How can I add a breakline on PHPMailer?
Thanks in advance!
Upvotes: 0
Views: 1082
Reputation: 14921
Since the email is sent in HTML, your \r\n
won't do anything.
You could use <br>
instead.
$message = '';
$message .= 'Line 1' . "<br>";
$message .= 'Line 2' . "<br>";
Upvotes: 1
Reputation: 121
I guess my first question would be are you sending text or html? If html then I would build it just like I would a form..
$message = '';
$message .= '<p>some fantastic question</p>';
$message .= '<p>another fantastic question</p>';
Upvotes: 0
Reputation: 756
$message = '';
$message .= 'Line 1' . "<br>";
$message .= 'Line 2' . "<br>";
if you use '<br>'
it may not work
Upvotes: 0