简体   繁体   English

我的服务器为什么不能发送外发电子邮件?

[英]Why can't my server send outgoing email?

I've been having a lot of trouble trying to configure my server so I can send emails through PHP. 尝试配置服务器时遇到了很多麻烦,因此我可以通过PHP发送电子邮件。 I've read all the tutorials I can find but nothing seems very clear and it all assumes you have substantial background knowledge with this sort of thing. 我已经阅读了所有可以找到的教程,但似乎还不清楚,并且都假定您对此类事情有丰富的背景知识。

The server is running CentOS with WHM/Cpanel and Apache. 该服务器正在运行带有WHM / Cpanel和Apache的CentOS。 Everything is working fine on it except for the outgoing email. 除了传出的电子邮件,其他一切工作正常。 The mail() function returns true and there are no errors, but no email is sent either. mail()函数返回true,没有错误,但也没有发送电子邮件。 The code worked fine on an older server and I've tried one line variants as well so I know it's not a problem with the code. 该代码在较旧的服务器上运行良好,并且我也尝试了一种行变体,因此我知道这不是代码的问题。 I double checked that my SMTP server was running (Exim) using the WHM tools and restarted it for good measure with no success. 我再次检查了我的SMTP服务器是否正在使用WHM工具运行(Exim),并重新启动它以取得良好效果,但未成功。

I am using Cloudflare as my DNS server and Google Apps for email. 我将Cloudflare用作DNS服务器,并将Google Apps用于电子邮件。 The Google Apps email works just fine. Google Apps电子邮件可以正常工作。 Could either of these things be affecting it? 这些事情都会影响它吗? Is there something special I have to set up if I want to use Google Apps and send email directly from my server as well? 如果我想使用Google Apps并直接从服务器直接发送电子邮件,我是否需要设置一些特殊设置? Is there a DNS record I need to add? 是否需要添加DNS记录? I honestly have no idea where to even start and nothing I've read has been the least bit helpful. 老实说,我什至不知道从哪里开始,我读过的东西对我毫无帮助。 I don't even know how to test my SMTP server to see if it's working or not. 我什至不知道如何测试SMTP服务器以查看其是否正常运行。

If I didn't include any needed information, please ask me and I'll provide it. 如果我没有提供任何必要的信息,请询问我,我会提供。

[Edit] I've checked my spam folder and there's no new emails in there. [编辑]我已经检查了我的垃圾邮件文件夹,并且那里没有新的电子邮件。 Here's what shows up in the Exim logs when I try to send the email. 这是我尝试发送电子邮件时Exim日志中显示的内容。 I've edited the domains. 我已经编辑了域。

2013-05-13 19:20:34 cwd=/var/spool/exim 2 args: /usr/sbin/exim -q
2013-05-13 19:20:34 Start queue run: pid=9766
2013-05-13 19:20:34 End queue run: pid=9766
2013-05-13 19:43:13 cwd=/home/admin/public_html/portal 3 args: /usr/sbin/sendmail -t -i
2013-05-13 19:43:13 1Uc2Of-0002eC-Go <= admin@svr1.example.ca U=admin P=local S=533 T="New Event/Hazard Report" for jake@example.ca
2013-05-13 19:43:13 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1Uc2Of-0002eC-Go
2013-05-13 19:43:13 1Uc2Of-0002eC-Go SMTP connection outbound 1368488593 1Uc2Of-0002eC-Go example.ca jake@example.ca
2013-05-13 19:43:15 1Uc2Of-0002eC-Go => jake@example.ca R=lookuphost T=remote_smtp H=aspmx.l.google.com [74.125.142.26] X=TLSv1:RC4-SHA:128
2013-05-13 19:43:15 1Uc2Of-0002eC-Go Completed

I would recommend your check you SPF records. 我建议您检查一下SPF记录。 Most of the time we see this problem, either the SPF was not set or set incorrectly: support 大多数情况下,我们看到此问题的原因是未设置SPF或设置错误: 支持

Similar problem here: 这里有类似的问题:

Cannot deliver email to Google Apps address; 无法将电子邮件发送到Google Apps地址; Gmail receives the same email fine Gmail收到相同的电子邮件罚款

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM