PHPMailer Script Failing With Cannot Connect Error
Written by:
Will Kruss
on
27 May 2019 12:40 PM
|
|
If you are running a mailing script based on the PHPMailer (or similar) libraries, you may find that even if port 25 and 587 outbound are open in the firewall you are receiving a cannot connect error. This occurs because the PHPMailer has the options to use direct sockets rather than standard SMTP port mailing. By default cPanel servers block direct socket access. If you are hosting sites you have built and are familiar with, then it should be safe to enable socket access. To do that in WHM go to Tweak Settings -> SMTP Tweaks. Look for the option SMTP_BLOCK and turn it off. This will allow direct socket access. Alternatively you can adjust the setting in your PHPMailer script to use the mail method for SMTP which uses the sendmail binary instead of direct socket access. | |
|