无法连接到"localhost"上的邮件服务器端口25,请验证您的"SMTP"和"smtp_port"在php.ini中设置或使用ini_set()

无法连接到

问题描述:

可能重复:
无法连接到"localhost"的邮件服务器端口25

Possible Duplicate:
Failed to connect to mailserver at “localhost” port 25

但是我用了这个

$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";

mail($to,$subject,$txt,$headers);

我遇到此错误,该错误无法通过"localhost"端口25连接到邮件服务器,无法验证php.ini中的"SMTP"和"smtp_port"设置或使用ini_set()

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上运行应用程序,而该应用程序尚未启用,我相信使用此应用程序发送邮件非常困难.

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.

将您的应用程序置于在线状态后,我相信应该自动解决此问题. 顺便说一句,ini_set()可帮助您在运行时更改php.ini中的值.

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.

这与无法连接到邮件服务器在本地主机"端口25

还要检查此 php邮件功能不起作用