cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution
Highlighted

Using office 365 Smtp For PhpMail

Hello,

I've been trying to use phpmailer in my website, but getting this error :

 

2019-07-03 07:12:42 Connection: opening to smtp.office365.com:587, timeout=15, options=array ()
2019-07-03 07:12:46 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.office365.com:587 (Connection refused) [/home/teehozsav9vl/public_html/x994/application/third_party/phpmailer/class.smtp.php line 298]
2019-07-03 07:12:46 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

Is it blocked?

 

1 REPLY 1
Super User II
Solution

Re: Using office 365 Smtp For PhpMail

Hello , I hope you are well. Most of the WordPress users are facing the issue while sending mails from WordPress using any plugins. Some of them are getting the error ‘SMTP ERROR: Failed to connect to server: Connection refused (111) error’.

 

To fix this error you would need to disable SMTP Restrictions, from your server.

  1. Login to WHM (Web Hosting Manager).
  2. Navigate to “SMTP Restrictions” under “Security Center”. The security center section of WHM allows you to improve the security on your server.
  3. o disable, SMTP restrictions you would need to click on the “Disable” button. This feature prevents users from bypassing the mail server to send mail, a common practice used by spammers. It will allow only the MTA, mailman, and root to connect to remote SMTP servers.
  4. Then you would need to navigate to “Tweak Settings” under “Server Configuration”. Tweak settings, allows you to configure many cPanel & WHM settings. Tabs at the top of the interface categorize the settings, and the all tab displays all of the settings.
  5. Disable “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)” on mail section. Enabling this feature will redirect outgoing SMTP connections to the local mail server. root, exim, and mailman are still allowed to make direct connections.

 

That’s it. The issue should be resolved now.

 

Zulfiqar Anees | GoDaddy PRO | Founder/CEO at TechMag, ZulWeb, Enter To Study