php mail() - >垃圾有时甚至没有收到? [英] php mail() -> junk, sometimes not even received?

查看:137
本文介绍了php mail() - >垃圾有时甚至没有收到?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phps mail()函数发送确认电子邮件。

I am using phps mail() function to send confirmation e-mails.

我知道的电子邮件在gmail和其他人收到我唯一真正的问题是将电子邮件发送到Hotmail或Yahoo帐户。

The e-mails get received on gmail and others as far as I'm aware, the only real problems I've had is when sending the e-mails to a Hotmail or Yahoo account.

我已经在互联网上阅读,许多人建议 PHPmailer

I have read on the internet and many people suggest PHPmailer

你们建议做什么发送php mail()?我创建的这个网站是一个合法的业务,我需要发送和接收邮件,无论我发送给谁。

What do you guys suggest to do when sending php mail()? This website I'm creating is for a legitimate business and I need mail to be sent and received no matter whom I send it to.

以下是我的代码,我现在已经使用特定的头来尝试解决问题。我拥有自己的专用服务器,我没有在任何垃圾邮件列表上列出黑名单,我可以想到的只是PHP本身。

Below is my code currently, I've used specific headers to try solve the problems. I own my own dedicated server and I'm not blacklisted on any spam lists, all I can think of is it is php itself.

$to = $email;
$subject = "Subject";
$body = "Message";
$headers .= "From: Accounts <accounts@site.com>\r\n";
$headers .= "Reply-To: <accounts@site.com>\r\n";
$headers .= "X-Sender: <accounts@site.com>\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . '\r\n'; //mailer
$headers .= "X-Priority: 3\r\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <accounts@site.com>\r\n";
$headers .= "MIME-Version: 1.0\r\n"; 
mail($to, $subject, $body, $headers);

非常感谢任何帮助。

推荐答案

使用PHPMailer或swiftmailer或其他任何图书馆在大多数情况下不会增加您的传送率:最有可能您的服务器设置成功。

Using PHPMailer, or swiftmailer or any other library won't increase your delivery rates in most cases: the most likely culprit is your server set up.

成功发送电子邮件是非常困难的,请阅读: http://www.codinghorror.com/blog/2010/04/so- you-like-to-send-some-email-through-code.html ,以了解必要的基本概况。

Sending email successfully is notoriously difficult, have a read here: http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html for a basic overview of what's necessary.

雅虎特别希望DKIM设置,如果您的ISP没有为您完成此操作,或者您正在使用VPS,可能是一个真正的痛苦。

Yahoo in particular really wants DKIM set up, and if your ISP hasn't done this for you, or you are on a VPS, can be a real pain.

成功发送电子邮件需要很多更不用说黑名单了。许多ISP的默认值是假设您是垃圾邮件,直到您有事情设置,这将使他们以其他方式思考。有罪无辜,直到被证明无辜。

Sucessfully sending email takes quite a bit more then simply not being on blacklists. The default of many ISPs it so assume you are SPAM until you have things set up that would make them think otherwise. Guilty until proven innocent.

在编码幽灵帖子中,请注意这一段:

In the codinghorror post, take note of this passage:


Port25提供了一个非常漂亮的公共
服务 - 您可以发送电子邮件到
check-auth@verifier.port25.com,它
将回复from:地址与
一个广泛的诊断!

Port25 offers a really nifty public service -- you can send email to check-auth@verifier.port25.com and it will reply to the from: address with an extensive diagnostic!

我不得不使用替代地址进行测试工作; check-auth2@verifier.port25.com。您可以在这里阅读每个地址为何进行测试的详细信息: http://www.port25.com/domainkeys /

I had to use an alternate address for the test to work; check-auth2@verifier.port25.com. You can read the details of why to test with each address here: http://www.port25.com/domainkeys/

从长远来看,如果您发送交易电子邮件(即不是大量邮件,而是回复用户操作的电子邮件),我建议一个像邮戳(postmarkapp.com)这样的服务,因为每个电子邮件的1/10分,你会得到所有丑陋的照顾。

In the long run, if you're sending transactional email (ie. not mass mailings but email in response to a user action) I recommend a service like postmark (postmarkapp.com) because at 1/10th of a cent per email, you get all the ugly taken care of for you.

这篇关于php mail() - &gt;垃圾有时甚至没有收到?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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