发送邮件失败?[php+;xampp]
在sendmail错误日志中,我收到以下错误:发送邮件失败?[php+;xampp],php,sendmail,Php,Sendmail,在sendmail错误日志中,我收到以下错误: 13.05.17 22:33:23 : Must issue a STARTTLS command first. x41sm21034997eey.17 - gsmtp<EOL> 13.05.17 23:02:55 : Must issue a STARTTLS command first. m48sm20850393eeh.16 - gsmtp<EOL> 13.05.17 23:08:05 : Must issue a S
13.05.17 22:33:23 : Must issue a STARTTLS command first. x41sm21034997eey.17 - gsmtp<EOL>
13.05.17 23:02:55 : Must issue a STARTTLS command first. m48sm20850393eeh.16 - gsmtp<EOL>
13.05.17 23:08:05 : Must issue a STARTTLS command first. bn53sm21242331eeb.7 - gsmtp<EOL>
13.05.17 23:43:54 : Must issue a STARTTLS command first. x41sm21511836eey.17 - gsmtp<EOL>
13.05.18 00:07:17 : Must issue a STARTTLS command first. w52sm21617356eev.12 - gsmtp<EOL>
13.05.18 03:03:16 : Must issue a STARTTLS command first. e50sm22561955eev.13 - gsmtp<EOL>
13.05.18 20:28:20 : Must issue a STARTTLS command first. d10sm3967825wik.0 - gsmtp<EOL>
13.05.19 05:14:31 : Must issue a STARTTLS command first. dj7sm5901394wib.6 - gsmtp<EOL>
我的代码:
mail
(
$email,
'Driptone - Activate your account',
'Hello '.$username.'. you must activate your account before
you can start using your account.
You can activate your account by clicking on the following link:
http://localhost/drip/activate.php?u='.$this->get['user_id'].'&a='.$this->get['generated_code'].'
Thank you,
Driptone.',
'From: noreply@driptone.com'
);
这有什么问题?它过去可以工作,但现在不行了?原因是gmail使用安全(TLS)服务器来防止垃圾邮件 确保您的PHP安装具有SSL支持(在
phpinfo()
的输出中查找“openssl”部分)
您可以在PHP.ini
中设置以下设置:
ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","587");
如果以上内容对您有所帮助,您也可以找到您的解决方案。请编辑您的问题并将路径添加到“sendMail”文件中。这样,其他试图学习它的人可以从你的问题中受益更多。
ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","587");