SMTP ERROR: Failed to connect to server: Connection timed out (110) with PHPMailer and Outlook SMTP

匿名 (未验证) 提交于 2019-12-03 01:57:01

问题:

I am getting SMTP Error with PHP Mailer and Outlook SMTP. I am confused here because it is working fine on localhost with Port number 25 but It is not working on Hosting Server, I have tried all ports with SSL & TLS.

Error : SMTP ERROR: Failed to connect to server: Connection timed out (110)



My Code:

IsSMTP(); $mail->Host = "smtp.live.com"; $mail->SMTPDebug = 2; $mail->Port = 587; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Username = "info@neelcomputech.com"; $mail->Password = "password"; $mail->Priority    = 1; $mail->CharSet     = 'UTF-8'; $mail->ContentType = 'text/html; charset=utf-8\r\n';  $mail->From = "info@neelcomputech.com"; $mail->FromName = $name; $mail->AddAddress("info@neelcomputech.com");  $mail->IsHTML(true);  $mail->Subject = "You got Message from Website"; $mail->Body = "testing";  if(!$mail->Send()) {     echo 'Mailer Error: ' . $mail->ErrorInfo; } else {     echo 'success'; }  ?> 


Please help me to solve this issue. I have Shared Linux Hosting.

回答1:

I had a similar problem, and it turned out my host (Bluehost) blocked outgoing connections on port 465. I will post the solution here in the hope that helps you. But I'm not expert enough to know if it's the same problem or not.

I found a wonderful how-to which fixed it for me:

  1. In your cPanel DNS Zone editor, find the MX (Mail Exchanger) section, and select 'remote mail exchanger'.
  2. In the cPanel email accounts section, create the appropriate email address (don't skip this)
  3. Don't use "smtp.live.com" as your smtp host. Use the smtp host of your Shared Linux Hosting smtp. I don't know how you will get yours. Mine is boxXXXX.bluehost.com.
  4. Set your username and password to be the same as the email account you just set-up in cPanel.


回答2:

None of the answers worked for me. After many hours, I found the problem, but only works for Cpanel/WHM

  • Login into WHM.
  • Go to ConfigServer Security & Firewall inside plugins option.
  • Click on Firewall configuration
  • Filter by SMTP Settings
  • Look for SMTP_ALLOWUSER option and add the Cpanel account's username separated by coma
  • Restart the Firewall.

If you don't have access to WHM ask your provider.

Hope it helps!



回答3:

Mos probably phpmailer not supported by your hosting. You must have to cross check by creating new file and check simple php email function. Most probably SMTP not configure at your hosting provider



回答4:

My code is correct.
The issue was with Hosting Provider. I contacted them about this and they did some configuration on their Server and it's done.



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