php:Textarea HTML值显示在Html电子邮件中? [英] php: Textarea HTML value to show in Html Email?

查看:117
本文介绍了php:Textarea HTML值显示在Html电子邮件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHPmailer,一切都很完美,除了< textarea> 中的文本显示为ONE SINGLE LINE。意思是,没有html值(仅限于TEXTAREA)。

I'm using PHPmailer and everything is perfect except the Texts inside <textarea> are showing as ONE SINGLE LINE. Meaning, no html value (for only TEXTAREA) at all.


  • 实际上邮件本身是HTML已经

  • 我可以嵌入图像..等。

  • 只是< textarea> 不工作。

  • Actually the mail itself is HTML already.
  • I can embed Images.. etc as well.
  • Just the <textarea> is not working.

我使用这个:

$mail->IsHTML(true);
$mail->Body = $_POST['textarea'];

让我们说< textarea> 像:

Hello,
How are you.

Best Wishes,
4lvin

然后在电子邮件中,它显示的就像:

Then in the email, it is showing just like:

Hello, How are you. Best Wishes, 4lvin

有什么想法吗? :(

推荐答案

使用

$mail->IsHTML(true);
$mail->Body = nl2br($_POST['textarea']);

这篇关于php:Textarea HTML值显示在Html电子邮件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆