如何使用 PHP 发送 HTML 格式的邮件? [英] How do I send HTML formatted mail using PHP?

查看:33
本文介绍了如何使用 PHP 发送 HTML 格式的邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过 mail() 发送 html 电子邮件,但是 gmail 只是将电子邮件显示为纯文本,没有标记,例如:

Trying to send a html email via mail(), however gmail just displays the email as plain text, no mark up, eg:

mail("blah@blah.com", "subject", "<i>Italic Text</i>");

只是显示为

<i>Italic Text</i>

有什么想法吗?

推荐答案

你要指定邮件的内容是HTML:

You have to specify that the contents of the mail is HTML:

mail("blah@blah.com", "subject", "<i>Italic Text</i>", "Content-type: text/html; charset=iso-8859-1");

这篇关于如何使用 PHP 发送 HTML 格式的邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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