Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMTP Error: Could not connect to SMTP host. After every 10 -14 days. #2195

Closed
iSarcasmxD opened this issue Nov 17, 2020 · 7 comments
Closed

Comments

@iSarcasmxD
Copy link

iSarcasmxD commented Nov 17, 2020

Weird Right. I get this error every 10-14 days. After I change my smtp host it works fine again for 11-14 days and then again gives the same error. It requires the same solution of switching host from google to cpanel and vice-versa everytime .

I have noticed this for about 2 months now and cannot find a solution anywhere apart from changing the smtp host everytime.
I'm going crazy. Please help!

Here is the debug for smtp host gmail:

2020-11-17 19:00:16 SERVER -> CLIENT: 220-linux.sitewithus.com ESMTP Exim 4.93 #2 Tue, 17 Nov 2020 11:00:16 -0800 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2020-11-17 19:00:17 CLIENT -> SERVER: EHLO www.loans4you.in
2020-11-17 19:00:17 SERVER -> CLIENT: 250-linux.sitewithus.com Hello www.loans4you.in [199.241.140.139]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2020-11-17 19:00:17 CLIENT -> SERVER: STARTTLS
2020-11-17 19:00:17 SERVER -> CLIENT: 220 TLS go ahead
SMTP Error: Could not connect to SMTP host.
2020-11-17 19:00:17 CLIENT -> SERVER: QUIT
2020-11-17 19:00:17
2020-11-17 19:00:17
SMTP Error: Could not connect to SMTP host.

Here it is for cpanel webmail:

2020-11-04 13:38:56 SERVER -> CLIENT: 220 mail.anaxanet.com is ready and awaiting your commands! Glad to meet you 199.241.140.139! How can I help you? The time now is Wed, 04 Nov 2020 13:38:57 +0000 (UTC).
2020-11-04 13:38:56 CLIENT -> SERVER: EHLO www.loans4you.in
2020-11-04 13:38:56 SERVER -> CLIENT: 250-mail.anaxanet.com Hello [199.241.140.139]250-SIZE 52428800250-AUTH LOGIN CRAM-MD5250-STARTTLS250-8BITMIME250 OK
2020-11-04 13:38:56 CLIENT -> SERVER: STARTTLS
2020-11-04 13:38:56 SERVER -> CLIENT: 220 Start TLS negotiation
SMTP Error: Could not connect to SMTP host.
2020-11-04 13:38:56 CLIENT -> SERVER: QUIT
2020-11-04 13:38:56 SERVER -> CLIENT:
2020-11-04 13:38:56 SMTP ERROR: QUIT command failed:
SMTP Error: Could not connect to SMTP host.

@Synchro
Copy link
Member

Synchro commented Nov 17, 2020

That's failing after STARTTLS, which suggests your local openssl has issues, most likely that you need to update your CA certificate bundle.

That said, the regularity of this failure is odd. I recommend double checking using openssl and testssl.sh to see where it's coming from.

@Synchro
Copy link
Member

Synchro commented Nov 17, 2020

Forgot to say - this could be caused by your hosting provider intermittently intercepting your SMTP traffic.

@iSarcasmxD
Copy link
Author

Thanks a lot @Synchro ! I will try updating the CA certificates and talk to my hosting provider. But I'm still confused and worried about the regularity of this issue. I will update this thread if I find the solution.

@iSarcasmxD
Copy link
Author

@Synchro Again I got the same error today ! Cannot find what the issue is here. Same error log as before. I am currently using the app password for a gmail account with 2fa enabled but that shouldn't be a problem cause it has been working fine for 14 days but now I have the problem again. Can you suggest any other solutions to this please.

Here is the error log for today.

2020-12-01 17:57:23 SERVER -> CLIENT: 220-linux.sitewithus.com ESMTP Exim 4.93 #2 Tue, 01 Dec 2020 09:57:23 -0800 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2020-12-01 17:57:23 CLIENT -> SERVER: EHLO www.loans4you.in
2020-12-01 17:57:23 SERVER -> CLIENT: 250-linux.sitewithus.com Hello www.loans4you.in [199.241.140.139]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2020-12-01 17:57:23 CLIENT -> SERVER: STARTTLS
2020-12-01 17:57:23 SERVER -> CLIENT: 220 TLS go ahead
SMTP Error: Could not connect to SMTP host.
2020-12-01 17:57:23 CLIENT -> SERVER: QUIT
2020-12-01 17:57:23
2020-12-01 17:57:23
SMTP Error: Could not connect to SMTP host.

@Synchro
Copy link
Member

Synchro commented Dec 1, 2020

This has nothing to do with authentication or 2FA. It's failing when establishing a TLS session which happens before it gets as far as auth. This isn't caused by PHPMailer – it must be something in your environment because PHPMailer just uses whatever is there. The main thing this needs is #1405, but PHP doesn't make it especially easy to find underlying causes of TLS errors.

@Synchro Synchro closed this as completed Dec 1, 2020
@iSarcasmxD
Copy link
Author

@Synchro Okay, I had a brief look at #1405. Now, can this be because I have these settings smtp_secure='tls' port="25" by any chance ? Because if I try to use any other port it gives me an 111 error. Please guide.

@Synchro
Copy link
Member

Synchro commented Dec 1, 2020

That combination is fine. SMTP+STARTTLS can coexist on ports that don't use encryption. As you can see in the transcript, it connects without encryption to a regular SMTP port, then starts it with STARTTLS (which you can see listed amongst the capabilities offered by the server). ssl mode (SMTPS) is different in that it expects TLS to start working immediately, which is marginally more secure, but harder to debug if it's not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants