Jump to content

SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting


ShimonBalkay

Recommended Posts

Hello,

I have tried adding my 2 SMTPs (SendGrid and Gsuite) both of them didn't work. With various ports and all, I contacted their support and also my hosting providor, they all said everything looks fine.

I am guessing its issue from WHMCS side. Can you guys tell me how to fix this error please?

SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

 

Link to comment
Share on other sites

  • 4 weeks later...

Hello 

I do this in configrution file:   $smtp_debug = true;

 

But my issue not solved till now.

After updating I got this error at the time of sending the mail to the customer:

 

2020-01-16 18:07:13 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Email Sending Failed - SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

Please help me out how to solve this issue permanently?

Link to comment
Share on other sites

  • 1 month later...
On 1/16/2020 at 12:13 PM, Ashish Garg said:

Hello 

I do this in configrution file:   $smtp_debug = true;

 

But my issue not solved till now.

After updating I got this error at the time of sending the mail to the customer:

 

2020-01-16 18:07:13 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Email Sending Failed - SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

Please help me out how to solve this issue permanently?

What was the resolution for this?! I'd love to get my setup going this weekend!

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • 1 month later...

I have the same problem, if I disable the firewall in WHM I use:

ConfigServer Security & Firewall - csf v14.05

The mail test works! I am still trying to pinpoint the exact setting that is preventing the mail to go through. I have tried a ton of different things so far... 

Here are the errors I get when the firewall is active:

SMTP Debug: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
SMTP Debug: SMTP ERROR: Failed to connect to server: Network is unreachable (101)
	
SMTP Debug: Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable) [/home/user/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 344]
SMTP Debug: Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array()

  This is what is on line 344 in the SMTP.php file

$host . ':' . $port,

Fingers crossed, if I figure it out I will update here 🙂

 

Chris

disabled edit.PNG

enabled edit.PNG

Link to comment
Share on other sites

I figured out what I needed to do! In>  ConfigServer Security & Firewall - csf v14.05

 

I added port 465...

Firewall Configuration Edit the configuration file for the csf firewall and lfd

IPv4 Port Settings

Allow outgoing TCP ports
TCP_OUT = 20,21,22,25,37,43,53,80,110,113,443,465,587,873,993,995,2086,2087,2089,2703
 
Hope this helps someone else 

 

Link to comment
Share on other sites

I figured out what I needed to do! In>  ConfigServer Security & Firewall - csf v14.05

 

I added port 465...

Firewall Configuration Edit the configuration file for the csf firewall and lfd

IPv4 Port Settings

Allow outgoing TCP ports
TCP_OUT = 20,21,22,25,37,43,53,80,110,113,443,465,587,873,993,995,2086,2087,2089,2703
 
And in the SMTP settings section I also had to remove port 465 from being blocked with SMTP_BLOCK on
 
Hope this helps someone else 

Chris

 

Link to comment
Share on other sites

On 10/18/2020 at 11:05 AM, sushichris said:

I figured out what I needed to do! In>  ConfigServer Security & Firewall - csf v14.05

 

I added port 465...

Firewall Configuration Edit the configuration file for the csf firewall and lfd

IPv4 Port Settings

Allow outgoing TCP ports
TCP_OUT = 20,21,22,25,37,43,53,80,110,113,443,465,587,873,993,995,2086,2087,2089,2703
 
And in the SMTP settings section I also had to remove port 465 from being blocked with SMTP_BLOCK on
 
Hope this helps someone else 

Chris

 

Thanks for the tip Chris!

It's also possible to add a single cPanel account username to the list in the "SMTP_ALLOWUSER" section in ConfigServer Security & Firewall (if you didn't want to update the allowed ports for all cPanel users).

Link to comment
Share on other sites

  • 8 months later...
  • 1 year later...

 

Hello 

I do this in configrution file:   $smtp_debug = true;

 

But my issue not solved till now.

After updating I got this error at the time of sending the mail to the customer:

 

2020-01-16 18:07:13 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Email Sending Failed - SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

Please help me out how to solve this issue permanently

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated