PHP邮件,DNS请求超时和FQDN [英] Mail of PHP, DNS request timed out, and FQDN

查看:159
本文介绍了PHP邮件,DNS请求超时和FQDN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Windows Server 2012 R2中使PHP的mail()工作.为此,我首先通过遵循SMTP. rel ="nofollow noreferrer">此页面.

I want to make mail() of PHP work in my Windows Server 2012 R2. To this end, I first installed SMTP by following this page.

使我困惑的一件事是Full-qualified domain name. WIN-RFELH8GM0KN是默认情况下建议的内容.我的服务器托管多个网站,有人知道我应该在此处指定哪个网站吗?

One thing that confuses me is the Full-qualified domain name. WIN-RFELH8GM0KN is what it proposes by default. My server hosts several websites, does anyone know which website I should specify here?

我没有更改此设置,因此,nslookup中的mail www.google.com返回DNS request timed out.,这是一个错误吗?

I did not change this, as a consequence, mail www.google.com in nslookup returns DNS request timed out. So is it an error?

原因,我的test.php不发送邮件:

Of cause, my test.php does not send the mail:

<?php
mail('mymail@gmail.com', 'title', 'content');
?>

有人可以帮忙吗?

更新1 在回答@LittleAI之后,我启动了SMTP,但是DNS request timed out仍然存在:

Update 1 Following the answer of @LittleAI , I started SMTP, but DNS request timed out is still there:

更新2 这是php.ini:

telnet localhost 25返回以下内容:

更新3 这是一个很好的测试:我确实在softtitmur@gmail.com的收件箱中收到了测试邮件.但是,如果我重做Update 1中的测试,仍然有DNS requested time out..而且test.php仍然无法发送邮件...

Update 3 Here was a test, which worked well: I did receive the test mail in the inbox of softtitmur@gmail.com. However, if I redo the test in Update 1, there is still DNS requested time out.. And test.php still cannot send the mail...

更新4 我刚刚在

Update 4 I just realised that in the page I followed, it is mail.vsysad.com under nslookup (I thought it was mail vsysad.com, that is why i tried mail www.google.com which did not make sense). So it works also in my server, and there is no DNS request timed out.

然后,我再次检查了php.ini,我意识到sendmail_from并非未注释.因此,我取消了注释并设置了sendmail_from = softtimur@gmail.com ,结果,php的mail()现在可以工作了,因此问题得以解决,尽管我仍然不了解FQDN及其默认值(即, WIN-RFELH8GM0KN)...

Then, I double checked php.ini, I realised that sendmail_from was not uncommented. So I uncommented it and set sendmail_from = softtimur@gmail.com, as a result, mail() of php works now, so the problem is solved, though I still don't understand FQDN and its default value (ie, WIN-RFELH8GM0KN)...

推荐答案

我注意到的第一件事是IIS中的SMTP虚拟服务未处于启动状态,因此会引起问题.在测试之前,请确保该服务处于启动状态.

The first thing I noticed is that your SMTP Virtual service in IIS is not in a starting state so this would cause an issue. Make sure this service is in a starting state before testing.

FQDN名称主要用于通过端口25连接到服务器时将显示发件人的SMTP标语.

The FQDN name is mainly used for the SMTP banner which the sender will be presented when connecting over port 25 to your server.

也许值得在您的服务器上安装DNS角色,并创建一个引用伪造域名的正向查找区域(例如test.com),并使用服务器IP在该区域中创建一条名为SMTP的记录.确保将服务器设置为使用127.0.0.1作为DNS提供程序,以便它可以在将响应委派给根提示/外部dns转发器之前检查记录.

It maybe worth installing the DNS role onto your server and create a forward lookup zone referencing a fake domain e.g test.com and create an a record within this zone called SMTP using your servers IP. Make sure to then set your server to use 127.0.0.1 as the DNS provider so it can check record before delegating the reponse to root hints/external dns forwarder.

您需要使用Telnet发出SMTP请求,以确认SMTP正在侦听端口25.您可以通过使用localhost ip地址(127.0.0.1)来做到这一点,如下所示:

You need to do an SMTP request using Telnet to confirm SMTP is listening on port 25. You can do this by using the localhost ip address (127.0.0.1) as shown below:

  telnet 127.0.0.1 25
  helo test.com
  MAIL FROM: ****YOUR EMAIL ACCOUNT****
  RCPT TO: ****SENDERS ADDRESS****
  DATA

由于SPF记录的存在,您可能不会收到从中继发送到GMAIL的电子邮件,该记录仅允许某些IP/主机名以google.com的形式发送,但为进行测试,您应该看到服务器在收到数据后将其接收到已输入.

You would probably not receive the email from your relay to GMAIL due to SPF Record which is in place that only allows certain IP/hostnames to send as google.com, but for testing you should see your server receive the mail after data has been inputted.

此处是在服务器上使用telnet的指南.只需确保已安装telnet功能,因为默认情况下未安装该功能.

Here is the guide for using telnet on your server. Just make sure you have telnet feature installed as this is not installed by default.

http://www.yuki-onna.co.uk/email/smtp.html

其他:

 telnet localhost 25

在SMTP标语之后,键入以下命令,但请确保不要犯任何错误,否则您可能需要重新开始会话.

After the SMTP banner type the following command in but make sure not to make any mistakes or else you'll need to probably start your sesssion all over again.

 helo test.com

然后您应该会看到一个250的响应,表明服务器正在侦听

You should then see a 250 response to say the server is listening

键入以下内容:

MAIL FROM: test@test.com

它应该以OK响应.如果是这样,则键入:

It should respond with OK. If so, then type:

RCPT TO: ***YOU EMAIL ADDRESS OF CHOICE****

同样,它应该以OK响应.如果是这样,请键入以下内容:

Again, it should respond with OK. If so, type the following:

DATA

在DATA命令后按Enter键.您现在进入了电子邮件的正文.出于测试目的,我们将忽略主题栏,仅将一些数据添加到正文中.

Press enter after the DATA command. Your now into the body of the email. For testing purposes we will miss the subject bar and just add some data to the body.

  This is a test email.

然后要完成电子邮件,您需要按回车键,然后按句号,然后再像这样再次返回,请在空白行中留空.

Then to complete the email you need to leave a blank line by pressing return, then a full stop, then return again like so.

    ***BLANK LINE****
    .
    ***Hit Return****

截屏了所有命令,但是您可以清空电子邮件,以便查看输出.

Screenshot all the commands but you can blank out the email so I can see the output.

这篇关于PHP邮件,DNS请求超时和FQDN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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