Problem with PHP's Mail () function error

Source: Internet
Author: User
<! 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.

<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.