完整的邮件标题 [英] Complete mail header
本文介绍了完整的邮件标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一组邮件头来附加到 PHP 中的 mail()
函数.我发送带有 HTML 的电子邮件,有时像 Yahoo Mail 之类的服务会阻止它们.因此,我需要确保我至少提供了正确的标题.
I need a set of mail headers to attach to my mail()
function in PHP. I send emails with HTML in them, and sometimes services like Yahoo Mail block them. Therefore I need to make sure that I am at least providing the right headers.
// To send HTML mail, the 'Content-type' header must be set
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
// Additional headers
$headers .= 'From: MyCompany <welcome@mycompany.com>' . "
";
还有什么我要补充的吗?
Is there anything else I should add?
推荐答案
$headers = "From: testsite <mail@testsite.com>
";
$headers .= "Cc: testsite <mail@testsite.com>
";
$headers .= "X-Sender: testsite <mail@testsite.com>
";
$headers .= 'X-Mailer: PHP/' . phpversion();
$headers .= "X-Priority: 1
"; // Urgent message!
$headers .= "Return-Path: mail@testsite.com
"; // Return path for errors
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=iso-8859-1
";
这篇关于完整的邮件标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文