以前的一个老站,也是wordpress搭建在sae的云应用上,可是一不小心密码忘记了,想通过邮箱找回,才发现原来sae禁用了mail函数,不能自动发送密码重置的邮件,提示:
无法发送电子邮件。
可能原因:您的主机禁用了mail()函数。
所以百度了一下,解决方法如下:
1. 找到自己主题下的functions.php,在文件最后添加代码
1 2 3 4 5 6 7 8 9 10 11 12 13 |
/** mail函数被禁用 **/ function mail_smtp( $phpmailer ){ $phpmailer->From = "biketotibet@163.com"; //发件人 $phpmailer->FromName = "骑车去西藏"; //发件人昵称 $phpmailer->Host = "smtp.163.com"; //SMTP服务器地址 $phpmailer->Port = 25; //SMTP端口,常用的有25、465、587,具体谷歌百度 $phpmailer->SMTPSecure = ""; //SMTP加密方式,常用的有SSL/TLS,具体谷歌百度 $phpmailer->Username = "biketotibet@163.com"; //邮箱帐号 $phpmailer->Password = '******'; //邮箱密码 $phpmailer->IsSMTP(); //使用SMTP发送 $phpmailer->SMTPAuth = true; //启用SMTPAuth服务 } add_action('phpmailer_init','mail_smtp'); |
2. 上传更新functions.php文件,问题解决
吃瓜群众表示 需要一个解决方案 不是路在前方的回复
添加代码后网站直接打不开,注释掉又恢复了。试了几次