PHPMailer error: SMTP -> ERROR: Failed to connect to server

北慕城南 提交于 2019-11-27 15:16:07

I believe port 25 is blocked on smtp.live.com. I cannot connect to smtp.live.com:25 from here either. Try using port 587 instead, with TLS. So, it would be:

$mail->Port = 587;
$mail->SMTPSecure = 'tls';   

I found a solution for this problem, try this

Check whether your PHP is using openSSL extension or not...!

  1. Edit your php.ini from your installed php folder
  2. Search for extension=php_openssl.dll
  3. The initial will look like this ;extension=php_openssl.dll
  4. Remove the ';' and it will look like this extension=php_openssl.dll
  5. If you can't find the extension=php_openssl.dll, add this line extension=php_openssl.dll.
  6. Then restart your Xampp or LAMP or APACHE server (depends upon which of these you're using).

Hope this method shall solve your problem...

You may want to check the supported ports. For instance, my host supports smtp via ports 25, 3535 and 80.
Using port 80 worked for me

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