Home  >  Article  >  Backend Development  >  php使用smtp发送邮件报错Cannot connenct to relay host

php使用smtp发送邮件报错Cannot connenct to relay host

WBOY
WBOYOriginal
2016-06-23 13:50:141991browse

使用DEDEcms自定义了一个发送邮件的php文件,使用了dedecms自带的mail.class.php,在本地可以正常发送,上传到服务器上后,出现提示Cannot connenct to relay host smtp.qq.com Error: () Error: Cannot send email to XXX@qq.com 网上找了一大堆文章,终于解决,问题出在服务器的环境配置上。

找到php.ini,查看两个地方,一个是allow_url_fopen,这个地方要设置成on;另一个地方是查看disable_functions,如果后面出现了fsock,fsockopen,则需要把这两个函数去掉,重启apache,然后就可以正常发送邮件了

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