简体   繁体   English

PHP中的电子邮件模板

[英]Email Template in PHP

I am trying to add paragraph in email template but not getting it done as I get confused because nl2br is not working in email template 我正在尝试在电子邮件模板中添加段落,但由于混淆而无法完成,因为nl2br在电子邮件模板中不起作用

Should I use \\r\\n and where to write it? 我应该使用\\r\\n以及在哪里写?

'email-message' => $data['mail-message'] 

There can be reason of content-type behind this issue. 此问题背后可能有content-type原因。 You need to use a <br> if your content-type is text/html . 如果您的content-typetext/html <br>则需要使用<br> content-type header is must otherwise your e-mail will be interpreted an plain text. 必须是content-type header ,否则您的电子邮件将被解释为纯文本。 In case If you want to use \\n you should use content-type: text/plain but then you will lose any markup. 如果要使用\\n ,则应使用content-type: text/plain但是这样会丢失任何标记。 So better to use content-type as text/html and use <br> . 因此,最好将content-type用作text/html并使用<br>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM