PHPMailer - how can I add interrupt lines to altbody?

How to add interrupt lines?

I use this:

$mailbody=$username."\r\n"; $mailbody.=$email."\r\n"; $altbody=$username."\r\n"; $altbody.=$email."\r\n"; 

But there are no fault lines.

I use $altbody because for some reason the software that I use to receive emails does not read HTML, only plain text, so $altbody is the body when the email reader does not support HTML, I can not use BR ...

Any ideas?

+6
source share
6 answers

usually strings with only \n should work in text email messages.
but stick with <br/> in the html-mail $mailbody .

+9
source

Do you have code earlier that formats the body of a message? You can accidentally delete all html tags and all \ (for example, if you use stripslashes).

0
source

I had a similar problem when I sent an email with text from HTML textarea . Solved it using php nl2br .

0
source

With PHPMailer, you need to use the whole <html> block. Try the following:

 $msg = "<html><body> Type your messsage here.<br><br> Sincerely,<br> <br> Contributor </body></html>"; 
0
source

You can try heredoc like

 $altbody = <<<MAIL Hello $username, Welcome to example.com! MAIL; 

or

 $altbody = <<<MAIL Hello $username,\nWelcome to example.com! MAIL; 
0
source
 $text = $sender_name."<br>"; $text .=$reply_to_email."<br>"; $text .= $Mobile_No."<br>"; $text .= $message."<br>"; 
0
source

Source: https://habr.com/ru/post/909973/


All Articles