[英]PHP Failed to connect to mailserver at mail.OURDOMAIN.com port 25 … However, I can telnet test mail through
There's a million posts on this error out there on the web: Failed to connect to mailserver at "mail.OURDOMAIN.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Web上有上百万个关于此错误的帖子:无法通过“ mail.OURDOMAIN.com”端口25连接到邮件服务器,无法在php.ini中验证“ SMTP”和“ smtp_port”设置或使用ini_set()
Here's the facts: 这是事实:
Before our site was forced to join the companies large SMTP server pool, our configuration was working fine (using a SMTP server managed by another group). 在我们的站点被迫加入公司的大型SMTP服务器池之前,我们的配置运行良好(使用由另一个组管理的SMTP服务器)。 As soon as we pointed the SMTP server entry to the new SMTP server, we get 'failed to connect' issues.
一旦我们将SMTP服务器条目指向新的SMTP服务器,就会出现“无法连接”的问题。
I can telnet to mail.OURDOMAIN.com 25 and successfully send a test mail through manually -- it should work. 我可以通过telnet到mail.OURDOMAIN.com 25并通过手动成功发送测试邮件-它应该可以工作。
I have the correct settings in php.ini and I've restarted the webserver. 我在php.ini中具有正确的设置,并且已经重新启动了网络服务器。
I also have used ini_set() for these settings and get the same results. 我还对这些设置使用了ini_set()并获得了相同的结果。
Very odd... any suggestions here? 很奇怪...这里有什么建议吗?
I'm using this code to test: 我正在使用以下代码进行测试:
<?php
//change this to your email.
$to = "joe.guy@OURDOMAIN.com";
$from = "joe.guy@OURDOMAIN.com";
$subject = "Hello! This is HTML email";
$message = "hello";
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($to, $subject, $message,$headers);
echo "Message has been sent....!";
?>
Here are my php.ini settings: 这是我的php.ini设置:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.OURDOMAIN.com
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = joe.guy@OURDOMAIN.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Try using the ip address of your domain instead of the name. 尝试使用您域的IP地址而不是名称。 That has worked for me a number of times.
这已经为我工作了很多次。
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = 127.0.0.1
ie: your own ip smtp server ip adress 即:您自己的IP SMTP服务器IP地址
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.