我需要一组邮件头来附加到我mail()
的PHP函数.我发送带有HTML的电子邮件,有时像Yahoo Mail这样的服务阻止它们.因此,我需要确保我至少提供正确的标题.
// To send HTML mail, the 'Content-type' header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: MyCompany' . "\r\n";
还有什么我应该补充的吗?
$headers = "From: testsite < mail@testsite.com >\n"; $headers .= "Cc: testsite < mail@testsite.com >\n"; $headers .= "X-Sender: testsite < mail@testsite.com >\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $headers .= "X-Priority: 1\n"; // Urgent message! $headers .= "Return-Path: mail@testsite.com\n"; // Return path for errors $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1\n";