doudou201701 2012-08-04 23:52
浏览 147

警告:mail()[function.mail]:无法连接到“localhost”端口25的邮件服务器,验证你的“SMTP”和“smtp_port”,XAMPP for WIndows XP

I am running a XAMPP server on Windows XP. Allegedly XAMPP automatically prepares a mail server.

This is the code I am using:

$cimzett = 'ledit4@gmail.com';
...
mail($cimzett, $targy, $uzenet, 'From:'.$email);

($cimzett means "to", $targy is subject, $uzenet is message in Hungarian) but in the browser appling PHP it sends me this message:

I get this error message:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\PHP\alien.php on line 50

I tried to use set_ini() function too, but I got the same message.

Maybe the security properties of XAMPP does not allow me send an email to gmail.com?

I use PHP Version 5.3.5 and

SMTP localhost localhost smtp_port 25 25

are the settings reported by phpinfo();

I suspect the mail server is not working properly. What do you think?

  • 写回答

4条回答 默认 最新

  • doushi1996 2012-08-05 00:04
    关注

    Windows does not by default have an SMTP server installed. XAMPP won't install one for you either. If there IS one installed, then it's not running, because "connection refuse" on port 25 means nothing's there listening for email.

    XAMPP will also not disable connections to external mail servers. However, Windows firewalls and/or some ISPs will (my isp does not allow external smtp connections as an anti-spam measure).

    评论

报告相同问题?