Home  >  Article  >  Backend Development  >  PHP 用mail()发邮件始终不成功。该怎么解决

PHP 用mail()发邮件始终不成功。该怎么解决

WBOY
WBOYOriginal
2016-06-13 11:39:461004browse

PHP 用mail()发邮件始终不成功。

<?php<br /><br />$to = "[email&#160;protected]";<br />$subject = "Test mail";<br />$message = "Hello! This is a simple email message.";<br />$from = "[email&#160;protected]";<br />$headers = "From: $from";<br />$send=mail($to,$subject,$message,$headers);<br />if($send)<br />echo "Mail Sent";<br />else <br />echo "Sorry,mail sent failed!"<br /><br />?>


开发环境用的wamp,下载并安装好了sendmail程序,按网上的说法也改好了php.ini和sendmail.ini
使用foxmail 7.1创建了自己QQ邮箱的账户,开启了POP3/SMTP服务。更改发件服务器为POP3,使用和收件服务器相同的身份验证。结果还是报错:Warning: mail(): SMTP server response: 503 Error: need EHLO and AUTH first ! in F:\PHP\wamp\www\mail.php on line 8
不知道哪个地方不对,请会的人指教下。谢谢!!!

mail() sendmail QQ邮箱
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn