PHPMailer: Called Mail() without being connected cPanel/WHM

PHPMailer is the most trusted PHP class to send emails that provide a complete set of features to enable you to send emails the easy way from your PHP apps. This class supports SMTP protocol too. WordPress and several other CMS systems use this class. If you have started using PHPMailer in your projects too and facing a bug like I faced recently on a client site, then here is the solution.

One of my clients was using PHPMailer on his cPanel/WHM VPS server but the email wasn’t being sent and PHPMailer was presenting an error ‘PHPMailer: Called Mail() without being connected‘. Remember that login credentials and ports were all correct. I researched for solutions on the web but didn’t find any specific solution that could address my issue.

At last, I started checking the options in WHM and found that ‘SMTP Restrictions‘ was enabled. I Just had to disable it and the issue resolved.

Remember that this is a security feature of WHM and when you will telnet the remote ports (465, 587), you will get connected but to get the PHPMailer working in your cPanel account, you have to disable SMTP Restrictions option. So simply search for SMTP Restrictions in the sidebar search box and then disable this feature. I hope this will resolve your all issues.

This guide is just for WHM/cPanel users. If you are still having issues after disabling this or if you are looking for a solution to this issue on a non-WHM server, then confirm that you are using the correct ports and login credentials. Generally, the port for SSL is 465 and for TLS, it is 587. You should contact your service provider (in my case Amazon SES) to get the correct credentials if other solutions don’t work for you.

Do you have any other fix for this? Or are you still facing issues with PHPMailer? Just post a comment below and I’ll try my best to help you as much as I can.

A blogger, web developer, and a freelancer from Gilgit-Baltistan Pakistan sharing his experiences with fellow Internet Marketers on this blog.

Leave a reply:

Your email address will not be published.

 

Site Footer

Sliding Sidebar