无法在端口25上Telnet到SMTP服务器,但PHP mail()可以工作

时间:2022-01-29 23:14:31

Not having found any answers to this question: PHP mail() function from inside VMWare virtual machine (Win7)

没有找到这个问题的任何答案:来自VMWare虚拟机(Win7)内部的PHP mail()函数

I have decided to try something new. I set up an SMTP relay on a machine. I can use it and receive mail inside its spooling directory just fine. However when I try to set it up to forward mail to an already configured SMTP server (called "mail", at port 25) it fails.

我决定尝试新的东西。我在一台机器上设置了一个SMTP中继。我可以使用它并在其假脱机目录中接收邮件就好了。但是,当我尝试将其设置为将邮件转发到已配置的SMTP服务器(称为“邮件”,在端口25)时,它将失败。

Telnet also fails on port 25, so it seems normal that it wouldn't work - "Connection refused" is the error from telnet.

Telnet也在端口25上失败,所以它似乎不正常 - “连接被拒绝”是来自telnet的错误。

But the really strange thing is that if I set up an Apache/PHP server on this machine and use the mail function of PHP (configured to connect to "mail" at port 25) it works! I can send emails from PHP (which I don't need) but I can't telnet to the machine.

但真正奇怪的是,如果我在这台机器上设置一个Apache / PHP服务器并使用PHP的邮件功能(配置为连接到端口25的“邮件”)它可以工作!我可以从PHP发送电子邮件(我不需要),但我不能telnet到机器。

Anyone ever see something like this? It's driving me crazy!

有谁见过这样的东西?这让我疯狂!

Thanks in advance

提前致谢

2 个解决方案

#1


0  

Have you checked the firewall settings? If your firewall isn't allowing connections from external addresses to port 25, but is allowing local connections to port 25, then that'd explain why PHP can use it just fine but you can't connect from the outside.

你检查过防火墙设置了吗?如果您的防火墙不允许从外部地址到端口25的连接,但允许本地连接到端口25,那么这就解释了为什么PHP可以正常使用它,但您无法从外部连接。

#2


0  

Have you tried to use the ip address of "mail" instead of the hostname.

您是否尝试使用“mail”的IP地址而不是主机名。

Network devices on Win 7 use ipv4 and ipv6 by default. If you specify the computername (not the DNS entry of the machine) while opening a connection (i.e. starting telnet) than "mail" may be resolved to either the ipv4 or the ipv6 address of that machine (more or less) at random. If your mailserver does only listen on the ipv4 address, you won't get a connection when "mail" is resolved.

Win 7上的网络设备默认使用ipv4和ipv6。如果在打开连接(即启动telnet)时指定计算机名(而不是计算机的DNS条目),则“mail”可以随机解析为该机器的ipv4或ipv6地址(或多或少)。如果您的邮件服务器只侦听ipv4地址,则在解决“邮件”时您将无法获得连接。

You can observe the same problem, when the machine "mail" has more then one network devices. Then it may resolve the computername to either of the addresses of the network devices.

当机器“mail”有多个网络设备时,您可以观察到同样的问题。然后,它可以将计算机名称解析为网络设备的任一地址。

#1


0  

Have you checked the firewall settings? If your firewall isn't allowing connections from external addresses to port 25, but is allowing local connections to port 25, then that'd explain why PHP can use it just fine but you can't connect from the outside.

你检查过防火墙设置了吗?如果您的防火墙不允许从外部地址到端口25的连接,但允许本地连接到端口25,那么这就解释了为什么PHP可以正常使用它,但您无法从外部连接。

#2


0  

Have you tried to use the ip address of "mail" instead of the hostname.

您是否尝试使用“mail”的IP地址而不是主机名。

Network devices on Win 7 use ipv4 and ipv6 by default. If you specify the computername (not the DNS entry of the machine) while opening a connection (i.e. starting telnet) than "mail" may be resolved to either the ipv4 or the ipv6 address of that machine (more or less) at random. If your mailserver does only listen on the ipv4 address, you won't get a connection when "mail" is resolved.

Win 7上的网络设备默认使用ipv4和ipv6。如果在打开连接(即启动telnet)时指定计算机名(而不是计算机的DNS条目),则“mail”可以随机解析为该机器的ipv4或ipv6地址(或多或少)。如果您的邮件服务器只侦听ipv4地址,则在解决“邮件”时您将无法获得连接。

You can observe the same problem, when the machine "mail" has more then one network devices. Then it may resolve the computername to either of the addresses of the network devices.

当机器“mail”有多个网络设备时,您可以观察到同样的问题。然后,它可以将计算机名称解析为网络设备的任一地址。