<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>phpinfo</title>
<body>
?
$to = "atoat@sina.com";
$subject = "Php-mail";
$msg = "I completely understand SMTP servers now!";
$headers = "from:atoat@163.comrnreply-to:atoat@163.com";
Mail ("$to", "$subject", "$msg", "$headers");
echo "finished!";
?>
</body>
Error occurred:
Warning:mail () [Function.mail]: SMTP server response:550 5.7.1 Unable to relay for atoat@sina.com in C:WEBSERVERHTDOCSWW wmail.php on line 14
PHP.ini Configuration situation
[Mail Function]
; For Win32.
SMTP = localhost
Smtp_port = 25
; For Win32.
Sendmail_from = atoat@163.com
Windows is already installed with its own SMTP service
It took a long time to find out. To add a native IP address to the SMTP service's relay options
Virtual Server-> Property-> access-> Relay
Select the => "Single computer" => add 127.0.0.1 Local address only
There is no problem with the program, but the message is not immediately available in the Inbox.
Did not receive because my machine is in the intranet, can not send mail to the extranet.
WORKAROUND: Make a port mapping at the gateway and map the 25 ports to the native. Or this machine has public network IP.