awesomemotive / WP-Mail-SMTP

The most popular WordPress SMTP and PHP Mailer plugin. Trusted by over 3 million sites.
https://wordpress.org/plugins/wp-mail-smtp/
GNU General Public License v3.0
55 stars 34 forks source link

SMTP Auth Error #109

Closed esetleges closed 2 years ago

esetleges commented 2 years ago

Expected Behavior

Send Emails

Current Behavior

Does not send emails

Possible Solution

Possibly something happened with the codes ~;D

Steps to Reproduce

Hi there,

It is started sometime ago (this year Sept/Oct) this error, before it was fine.

Find details below:

WP:5.8.2 PHP:7.4.26 WP Mail:3.2.1 Email: Other SMTP – gmail with App Password (gmail handles our domain for outgoing emails)- Settings: smtp.gmail.com, TLS, 587, Auth ON

– Test emails are working fine, so cannot get for your detailed log – Not all the time fails but mostly – Did not reinstall yet the WP Mail

Error Event: Content Mailer: Other SMTP SMTP Error: Could not authenticate. Source Wordfence Security /home/customer/www/ourdomain.com/public_html/wp-content/plugins/wordfence/lib/wordfenceClass.php (line: 7161) wfConfig::set('lastEmailHash', time() . ':' . $hash); foreach ($emails as $email) { $uniqueContent = $content . "\n\n" . sprintf(/* translators: WordPress admin panel URL. */ __('No longer an administrator for this site? Click here to stop receiving security alerts: %s', 'wordfence'), wfUtils::getSiteBaseURL() . '?_wfsf=removeAlertEmail&jwt=' . wfUtils::generateJWT(array('email' => $email))); wp_mail($email, $subject, $uniqueContent);

7161 line is wp_mail($email, $subject, $uniqueContent)

Other Error Event:

Content Mailer: Other SMTP SMTP Error: Could not authenticate. Source BackWPup /home/customer/www/ourdomain.com/public_html/wp-content/plugins/backwpup/inc/class-job.php (line: 1152)

if ( $bracket_pos === false || $at_pos === false ) { $this->job['mailaddresssenderlog'] = str_replace( array( '<', '>', ), '', $this->job['mailaddresssenderlog'] ) . ' <' . get_bloginfo( 'admin_email' ) . '>'; } $headers[] = 'From: ' . $this->job['mailaddresssenderlog']; } wp_mail( $this->job['mailaddresslog'], $subject, file_get_contents( $this->logfile ), $headers );

Line 1152: wp_mail( $this->job['mailaddresslog'], $subject, file_get_contents( $this->logfile ), $headers `);

Debug event when WFence was succeed:

Content An email request was sent. Source Wordfence Security /home/customer/www/ourdomain.com/public_html/wp-content/plugins/wordfence/lib/wfActivityReport.php (line: 508) if (!wp_mail($email, sprintf(/* translators: 1. Site URL. 2. Localized date. */ __('Wordfence activity for %1$s on %2$s', 'wordfence'), date_i18n(get_option('date_format')), $shortSiteURL), $uniqueContent, 'Content-Type: text/html')) { $success = false;

Cheers, gabor

M-51 commented 2 years ago

I had the same problem but with woocomerce, most emails were working, but some (password reset, new account) not.

What helped. If you are using SMTP settings with constants in wp-config.php, be sure that all your email constants, eg:

define( 'WPMS_ON', true );
define( 'WPMS_SMTP_USER', 'user@email.com' ); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true.
define( 'WPMS_SMTP_PASS', 'somepassword' ); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true.

goes before that line:

/* That's all, stop editing! Happy publishing. */

So it should be

define( 'WPMS_ON', true );
define( 'WPMS_SMTP_USER', 'user@email.com' ); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true.
define( 'WPMS_SMTP_PASS', 'somepassword' ); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true.
...
/* That's all, stop editing! Happy publishing. */

And not:

/* That's all, stop editing! Happy publishing. */
...
define( 'WPMS_ON', true );
define( 'WPMS_SMTP_USER', 'user@email.com' ); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true.
define( 'WPMS_SMTP_PASS', 'somepassword' ); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true.

See also https://wordpress.org/support/topic/smtp-error-could-not-authenticate-22/ And https://github.com/awesomemotive/WP-Mail-SMTP/issues/101

capuderg commented 2 years ago

Hi @M-51,

thank you for stepping in and providing relevant information. We really appreciate it!

@esetleges please test out what @M-51 suggested and let us know if you'll still experience these issues.

Take care!

esetleges commented 2 years ago

@M-51 , @capuderg

Hi there and thanks for links, respondings!

101, seems pretty similar issue. I configured all settings/constants in wp-config.php. Test email is working, activated the Debug mode for testing, now only waiting for having some automaticly generated report.

Will feed you back later!

Nooby question: Is there any more than "a comment" means of / That's all, stop editing! Happy publishing. / line in wp-config? I havent had this line under the WP Mail constans (now I added to be sure-sure:D) although I have line like this too: / That's all, stop editing! Happy blogging. /

IN MEANWHILE I found the respond for this last question: Yes, that is only a comment before ABSPATH constant (what should be the last thing)