邮件在PHP中生成垃圾邮件 [英] Mail generated in PHP going to spam

查看:167
本文介绍了邮件在PHP中生成垃圾邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

PHP:如何避免系统生成的电子邮件进入垃圾邮件?

如何每周发送100,000封电子邮件?

我正在使用以下脚本发送邮件

I am using the following script to send mail

$to  = 'name@test.com' . ', '; 
$to .= 'name2@test.com';

$subject = 'Green apple';

$message = 'Enquiry posted by test ';

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


$headers .= 'From: Green Apple <info@greenappleme.com>' . "\r\n";


if (mail($to, $subject, $message, $headers))
{
    echo "mail send successfully";
}
else  
    echo "mail can't send";

当我将这个脚本用于某些服务器时,邮件将被发送到垃圾邮件。但是在某些服务器中,根据需要进入收件箱。

When I use this script to some servers, the mail is going to spam. But in some servers, it is going to the Inbox as desired.

如何防止电子邮件发送到垃圾邮件?

How can I prevent email going to spam?

推荐答案

为防止电子邮件进入垃圾邮件,请勿从PHP发送邮件。使用SMTP从您的服务器发送,您可以使用PHP连接到SMTP并提交消息。然后,您需要在服务器上设置SPF记录,并将DNS记录与您的IP地址来自哪里。如果你做这三件事情,那么你会在白名单上,所有的电子邮件都会进入收件箱,假设你没有滥用权限并把它放在黑名单上。

To prevent an email going into spam, don't send with mail from PHP. Send it with SMTP from your server, you can use PHP to connect to SMTP and submit the message. You will then need to set the SPF records on your server, and reverse DNS records with whoever your IP address comes from. If you do these three things then you'll be on the whitelist and all your emails will go into the inbox everywhere, assuming you don't abuse the privilege and get put on a blacklist.

所以:使用SMTP发送,研究SPF记录和反向DNS。

So: send using SMTP, research SPF records and reverse DNS.

除非您有专用服务器,否则您将无法执行此操作您要从中发送电子邮件地址的IP。

You won't be able to do this unless you have a dedicated server with dedicated IP for the domain from which you are sending the email from.

这篇关于邮件在PHP中生成垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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