我需要一个兼容的电子邮件标题 [英] What do I need for a compliant email header

查看:535
本文介绍了我需要一个兼容的电子邮件标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从正在建立的网站发送电子邮件,但最终会在yahoo垃圾邮件文件夹中。这是发送凭证的电子邮件。我可以做些什么来合法化?

I am trying to send an email from a site I am building, but it ends up in the yahoo spam folder. It is the email that sends credentials. What can I do to legitimize it?

$header = "From: site <sales@site.com>\r\n";
$header .= "To: $name <$email>\r\n";
$header .= "Subject: $subject\r\n";
$header .= "Reply-To: site <sales@site.com>" . "\r\n";
$header .= "MIME-VERSION: 1.0\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$phpversion = phpversion();
$header .= "X-Mailer: PHP v$phpversion\r\n";
mail($email,$subject,$body,$header);


推荐答案

除了Ted Percival的建议,您可以尝试使用 PHPMailer 为您创建电子邮件,而不是手动构建标题。我已经广泛使用了这个类,没有任何麻烦,电子邮件被Yahoo或其他人拒绝为垃圾邮件。

In addition to Ted Percival's suggestions, you could try using PHPMailer to create the emails for you rather than manually building the headers. I've used this class extensively and not had any trouble with email being rejected as spam by Yahoo, or anyone else.

这篇关于我需要一个兼容的电子邮件标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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