use of phpmailer class

梦想与她 提交于 2019-12-06 06:15:22
Damien Pirsy

By using GMail, your settings might likely not be correct; try these (corrected port and SSL address):

$mail->Port       =  465;                   // set the SMTP server port
$mail->Host       = "ssl://smtp.gmail.com"; // SMTP server
$mail->Username   = "test@gmail.com";       // SMTP server username
$mail->Password   = "1234567889";   

Alternatively, use TLS:

$mail->Port       =  587;                   // set the SMTP server port
$mail->Host       = "tls://smtp.gmail.com"; // SMTP server

Edit: Remove this line below (You first provide settings to use SMTP, then you tell it to use and send trough sendmail and you put a wrong path in configs. Just stick to one service, use SMTP with above settings (or edit2 below) and see):

Remove:

$mail->IsSendmail();  // tell the class to use Sendmail

Edit2: other option (in case the first answer don't work):

$mail->SMTPSecure = 'ssl'; 
$mail->Host = 'smtp.gmail.com';
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!