NamelessMC

Internet Explorer

Internet Explorer is not supported. Please upgrade to a more modern browser.

SMTP Error
Started by RaffaelegamerYT

RaffaelegamerYT

RaffaelegamerYT

Member
Joined
31 Mar 2021
Last Seen
18 Apr 2022
Topics
1
Posts
1

When the site has to send some mail it gives me this error: SMTP Error: Could not authenticate.

How do I resolve?

It's urgent

x1
RaffaelegamerYT · over 3 years ago
Naird

Naird

Member
Joined
29 Dec 2020
Last Seen
27 Jan 2024
Topics
0
Posts
4

I'm also experiencing the same issue, using Gmail, it was working a few days ago, but emails failed to send, now being given the "failed to connect to SMTP server" error when sending test email.

Naird · over 3 years ago
Samerton

Samerton

Owner
Joined
30 Mar 2015
Last Seen
22 Nov 2024
Topics
41
Posts
1076

Hi,

To get more information about this error, you can edit the fileĀ core/classes/Email.php in a text editor. Delete all code inside, and replace with this new code.

Then, when you send a test email in the StaffCP, a full debug log will appear on screen with the exact communications between your web server and the SMTP server. This should include some hints as to what the problem is.

Once you have the full log, revert the contents of core/classes/Email.php back to its original code.

Samerton · over 3 years ago
Naird

Naird

Member
Joined
29 Dec 2020
Last Seen
27 Jan 2024
Topics
0
Posts
4
Samerton:

Hi,

To get more information about this error, you can edit the fileĀ core/classes/Email.php in a text editor. Delete all code inside, and replace with this new code.

Then, when you send a test email in the StaffCP, a full debug log will appear on screen with the exact communications between your web server and the SMTP server. This should include some hints as to what the problem is.

Once you have the full log, revert the contents of core/classes/Email.php back to its original code.

I've done that now, here's the log it's outputting:

Spoiler
2021-04-05 08:16:29 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
2021-04-05 08:16:29 Connection: opened
2021-04-05 08:16:29 SMTP -> get_lines(): $data is ""
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "220-m3499.contabo.net ESMTP Exim 4.94 #2 Mon, 05 Apr 2021 10:16:29 +0200 "
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "220-m3499.contabo.net ESMTP Exim 4.94 #2 Mon, 05 Apr 2021 10:16:29 +0200 "
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "220-We do not authorize the use of this system to transport unsolicited, "
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "220-m3499.contabo.net ESMTP Exim 4.94 #2 Mon, 05 Apr 2021 10:16:29 +0200 220-We do not authorize the use of this system to transport unsolicited, "
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "220 and/or bulk e-mail."
2021-04-05 08:16:29 SERVER -> CLIENT: 220-m3499.contabo.net ESMTP Exim 4.94 #2 Mon, 05 Apr 2021 10:16:29 +0200 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2021-04-05 08:16:29 CLIENT -> SERVER: EHLO forum.yogs.net
2021-04-05 08:16:29 SMTP -> get_lines(): $data is ""
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-SIZE 52428800"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-8BITMIME"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800250-8BITMIME"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-PIPELINING"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800250-8BITMIME250-PIPELINING"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-X_PIPE_CONNECT"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800250-8BITMIME250-PIPELINING250-X_PIPE_CONNECT"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800250-8BITMIME250-PIPELINING250-X_PIPE_CONNECT250-AUTH PLAIN LOGIN"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250-STARTTLS"
2021-04-05 08:16:29 SMTP -> get_lines(): $data is "250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800250-8BITMIME250-PIPELINING250-X_PIPE_CONNECT250-AUTH PLAIN LOGIN250-STARTTLS"
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "250 HELP"
2021-04-05 08:16:29 SERVER -> CLIENT: 250-m3499.contabo.net Hello forum.yogs.net [193.34.145.202]250-SIZE 52428800250-8BITMIME250-PIPELINING250-X_PIPE_CONNECT250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2021-04-05 08:16:29 CLIENT -> SERVER: STARTTLS
2021-04-05 08:16:29 SMTP -> get_lines(): $data is ""
2021-04-05 08:16:29 SMTP -> get_lines(): $str is "220 TLS go ahead"
2021-04-05 08:16:29 SERVER -> CLIENT: 220 TLS go ahead
2021-04-05 08:16:29 Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`*.contabo.net' did not match expected CN=`smtp.gmail.com' [/home/ki116378/yogsforum/core/includes/phpmailer/class.smtp.php line 374]
SMTP Error: Could not connect to SMTP host.
2021-04-05 08:16:29 CLIENT -> SERVER: QUIT
2021-04-05 08:16:29 SMTP -> get_lines(): $data is ""
2021-04-05 08:16:29
2021-04-05 08:16:29
2021-04-05 08:16:29
2021-04-05 08:16:29 Connection: closed
SMTP Error: Could not connect to SMTP host.

Contabo is my webhost, it looks like it's trying to use Contabo's email system instead of Google's?

Naird · over 3 years ago
Samerton

Samerton

Owner
Joined
30 Mar 2015
Last Seen
22 Nov 2024
Topics
41
Posts
1076

Exactly, as you say it looks like Contabo is routing the request through its own systems.

Can you please open a support ticket with your web host, they might be able to help with the issue.

x1
Samerton · over 3 years ago