无法通过“localhost”端口 25 连接到邮件服务器,请验证 php.ini 中的“SMTP”和“smtp_port”设置或使用 ini_set()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4591329/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
提问by Ivan Reuben Ramos Muit
Possible Duplicate:
Failed to connect to mailserver at “localhost” port 25
I used this one however
然而我用了这个
$to = "[email protected]";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: [email protected]" . "\r\n" .
"CC: [email protected]";
mail($to,$subject,$txt,$headers);
I have this error which is Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
我有这个错误,即无法在“localhost”端口 25 连接到邮件服务器,请验证 php.ini 中的“SMTP”和“smtp_port”设置或使用 ini_set()
回答by Programmer
If you are running your application just on localhost and it is not yet live, I believe it is very difficult to send mail using this.
如果您仅在 localhost 上运行您的应用程序并且它还没有上线,我相信使用它发送邮件是非常困难的。
Once you put your application online, I believe that this problem should be automatically solved. By the way,ini_set() helps you to change the values in php.ini during run time.
一旦你把你的应用程序放到网上,我相信这个问题应该会自动解决。顺便说一下,ini_set() 可以帮助您在运行时更改 php.ini 中的值。
This is the same question as Failed to connect to mailserver at "localhost" port 25
这与Failed to connect to mailserver at "localhost" port 25 相同
also check this php mail function not working
还要检查这个php 邮件功能不起作用