HTML中的php邮件功能 [英] HTML in php mail function
问题描述
我想使用一个HTML链接电子邮件,我也想要用户发送给我的内容,他们是如何想要的....让我解释一下。
如果用户发送:
Hello World!
这不是一个伟大的一天吗?
没有使用标题来启用html,那么当它到达我时就这样形成了。 >
如果我使用标头(MIME)来启用html,还要在电子邮件中包含一个链接(我想要做的),然后它到达我:
Hello World!Is not it a great Day?
如何包含html,并保持电子邮件格式正确?
谢谢
希望所有这一切都有意义:S
在您的信息中使用 nl2br
- http://php.net/manual/en/function.nl2br.php
它将用HTML < br>
$ message = nl2br($ message,false);
第二个参数* is_xhtml *是可选的,如果要发送HTML电子邮件而不是XHTML
I have a contact form on my website so users can send me an email but I have run into a problem.
I want to use an HTML link inside the email and I also want the content the user is sending to me to be formated how they would like it.... let me explain.
If a user sends this:
Hello World!
Isnt it a great Day?
without using headers to enable html, then it says formated like that when it reaches me.
If I use headers (MIME) to enable html, to also include a link in the email (which I would like to do), then it reaches me as:
Hello World!Isnt it a great Day?
How can I include html, and also keep the email formatted properly?
Thanks
And hopefully all this makes sense :S
Use nl2br
on your message - http://php.net/manual/en/function.nl2br.php
It will replace all newlines with HTML <br>
$message = nl2br($message, false);
The second parameter *is_xhtml* is optional if you want to send an HTML email instead of XHTML
这篇关于HTML中的php邮件功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!