PHP邮件,DNS请求超时和FQDN

柔音

我想在自己mail()的PHP中使用PHP Windows Server 2012 R2为此,我首先SMTP按照此页面进行安装

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

我并没有改变这一点,因此,mail www.google.comnslookup返回DNS request timed out.所以它是一个错误?

在此处输入图片说明

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

<?php
mail('[email protected]', 'title', 'content');
?>

有人可以帮忙吗?

更新1按照@LittleAI的回答,我启动了SMTP,但DNS request timed out仍然存在:

在此处输入图片说明

Update 2 Here is php.ini:

在此处输入图片说明

telnet localhost 25 returns the follows:

在此处输入图片说明

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

在此处输入图片说明

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.

在此处输入图片说明

Then, I double checked php.ini, I realised that sendmail_from was not uncommented. So I uncommented it and set sendmail_from = [email protected], 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)...

Kitson88

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.

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

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.

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

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.

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

Additional:

 telnet localhost 25

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

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

The type the following:

MAIL FROM: [email protected]

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

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

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

DATA

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****

对所有命令进行屏幕快照,但是您可以清空电子邮件,以便查看输出。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章