Ec (2); & lt ;! DOCTYPEhtmlPUBLIC & quot;-W3CDTDXHTML1.0TransitionalEN & quot; www. w3.orgTRxhtml1DTDxhtml1-transitional. dtd & quot; & gt; & lt; htmlxmlns & quot; www. w script ec (2); script
Phpinfo
$ 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! ";
?>
Error:
Warning: mail () [function. mail]: SMTP server response: 550 5.7.1 Unable to relay for atoat@sina.com in C: webserverhtdocswwwmail. php on line 14
Php. ini configuration
[Mail function]
; For Win32 only.
SMTP = localhost
Smtp_port = 25
; For Win32 only.
Sendmail_from = atoat@163.com
You have installed the smtp service that comes with windows.
It took a long time to find that the local IP address needs to be added to the smtp service relay option.
Virtual Server-> properties-> access-> Relay
Select "only the following list" => "single computer" => Add a local address of 127.0.0.1
The program has no problem, but the inbox does not receive the message immediately.
I did not receive the email because my machine is in the internal network and cannot send the email to the Internet.
Solution: Create a port ing in the gateway to map port 25 to the local machine, or the local machine has a public IP address.
<