WP Mail SMTP

Error with WP Mail SMTP

You may have this kind of error with WP Mail SMTP :

EMAIL DELIVERY ERROR: the plugin WP Mail SMTP v2.2.1 logged this error during the last time it tried to send an email:

Mailer: Gmail
{
“error”: “invalid_grant”,
“error_description”: “Token has been expired or revoked.”
}
Please re-grant Google app permissions!
Go to WP Mail SMTP plugin settings page. Click the “Remove Connection” button.
Then click the “Allow plugin to send emails using your Google account” button and re-enable access.

Or :

Mailer: Gmail
{
“error”: {
“code”: 401,
“message”: “Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.”,
“errors”: [
{
“message”: “Login Required.”,
“domain”: “global”,
“reason”: “required”,
“location”: “Authorization”,
“locationType”: “header”
}

Or :

PHP Fatal Error: Uncaught Error: Class 'WPMailSMTP\Tasks\Meta' not found in /wp-content/plugins/wp-mail-smtp/src/Migration.php:209
Stack trace:
#0 /wp-content/plugins/wp-mail-smtp/src/Migration.php(134): WPMailSMTP\Migration->migrate_to_2()
#1 /wp-content/plugins/wp-mail-smtp/src/Migration.php(118): WPMailSMTP\Migration->run()
#2 /wp-content/plugins/wp-mail-smtp/src/Migration.php(91): WPMailSMTP\Migration->maybe_migrate()
#3 /wp-content/plugins/wp-mail-smtp/src/Core.php(306): WPMailSMTP\Migration->__construct()
#4 /wp-content/plugins/wp-mail-smtp/src/Core.php(136): WPMailSMTP\Core->get_migration()
#5 /wp-includes/class-wp-hook.php(287): WPMailSMTP\Core->init()
#6 /wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
#7 /wp-includes/plugin.php(478): WP_Hook->do_action()
#8 /wp-settings.php(540): do_action()
#9 /wp-config.php(125): require_once('/w...')

Or :

An error of type E_ERROR was caused in line 79 of the file /wp-content/plugins/wp-mail-smtp/src/Providers/MailerAbstract.php. Error message: Uncaught TypeError: Argument 1 passed to WPMailSMTP\Providers\MailerAbstract::__construct() must implement interface WPMailSMTP\MailCatcherInterface, instance of PHPMailer\PHPMailer\PHPMailer given, called in /wp-content/plugins/wp-mail-smtp/src/Providers/Loader.php on line 190 and defined in /wp-content/plugins/wp-mail-smtp/src/Providers/MailerAbstract.php:79
Stack trace:
#0 /wp-content/plugins/wp-mail-smtp/src/Providers/Loader.php(190): WPMailSMTP\Providers\MailerAbstract->__construct(Object(PHPMailer\PHPMailer\PHPMailer))
#1 /wp-content/plugins/wp-mail-smtp/src/Providers/Loader.php(146): WPMailSMTP\Providers\Loader->get_entity(‘smtp’, ‘Mailer’)
#2 /wp-content/plugins/wpforms-lite/src/Admin/Pages/SMTP.php(451): WPMailSMTP\Providers\Loader->get_mailer(‘smtp’, Object(PHPMailer\PHPMailer\PHPMailer))
#3 /wp-content/plugins/wpforms-lite/src/Admin/Pages/SMTP.php(476

Or :

Got error ‘PHP message: PHP Fatal error: Uncaught Error: Cannot access protected property WPMailSMTP\\MailCatcher::$LE in /wp-content/plugins/wp-mail-smtp-pro/src/Pro/Emails/Logs/Providers/SMTP.php:50\nStack trace:\n#0 /wp-content/plugins/wp-mail-smtp-pro/src/Pro/Emails/Logs/Logs.php(463): WPMailSMTP\\Pro\\Emails\\Logs\\Providers\\SMTP->save_before()\n#1 /wp-includes/class-wp-hook.php(287): WPMailSMTP\\Pro\\Emails\\Logs\\Logs->process_smtp_pre_send_before()\n#2 /wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()\n#3 /wp-includes/plugin.php(478): WP_Hook->do_action()\n#4 /wp-content/plugins/wp-mail-smtp-pro/src/MailCatcher.php(81): do_action()\n#5 /wp-includes/pluggable.php(498): WPMailSMTP\\MailCatcher->send()\n#6 /wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(653): wp…’,

Or :

E-MAIL Dispatch ERROR: The plugin WP Mail SMTP v2.2.1 has logged this error during the last attempt to send an e-mail. mailer: Other SMTP connection, SMTP Error: data not accepted. Please review your SMTP settings in…

Or :

Deprecated: class-phpmailer.php is deprecated since version 5.5.0! Use wp-includes/PHPMailer/PHPMailer.php instead. The PHPMailer class has been moved to wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace. in \wp-includes\functions.php on line 4963

Deprecated: class-smtp.php is deprecated since version 5.5.0! Use wp-includes/PHPMailer/SMTP.php instead. The SMTP class has been moved to the wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace. in \wp-includes\functions.php on line 4963

Fatal error: Cannot declare class PHPMailer\PHPMailer\SMTP, because the name is already in use in \wp-includes\PHPMailer\SMTP.php on line 30

Or :

EMAIL DELIVERY ERROR: the plugin WP Mail SMTP v2.8.0 logged this error during the last time it tried to send an email: Mailer: Gmail { “error”: “invalid_grant”, “error_description”: “Token has been expired or revoked.” } Please re-grant Google app permissions! Go to WP Mail SMTP plugin settings page. Click the “Remove Connection” button. Then click the “Allow plugin to send emails using your Google account” button and re-enable access. Consider running an email test after fixing it

Or :

EMAIL DELIVERY ERROR: the plugin WP Mail SMTP v2.1.1 logged this error during the last time it tried to send an email:

Mailer: Other SMTP
The following From address failed: (the email address I used to send my message) : MAIL FROM command failed,Request failed; Mailbox unavailable
,550,SMTP server error: MAIL FROM command failed Detail: Request failed; Mailbox unavailable
SMTP code: 550
Consider running an email test after fixing it.

Or :

PHP Warning: include(/wp-content/plugins/wp-mail-smtp/vendor/composer/../../vendor_prefixed/sendinblue/api-v3-sdk/lib/Api/TransactionalEmailsApi.php): failed to open stream: No such file or directory in /wp-content/plugins/duplicate-post/vendor/composer/ClassLoader.php on line 444PHP message: PHP Warning: include(): Failed opening ‘/wp-content/plugins/wp-mail-smtp/vendor/composer/../../vendor_prefixed/sendinblue/api-v3-sdk/lib/Api/TransactionalEmailsApi.php’ for inclusion (include_path=’.:/opt/plesk/php/7.4/share/pear’) in /wp-content/plugins/duplicate-post/vendor/composer/ClassLoader.php on line 444PHP message: PHP Fatal error: Uncaught Error: Class ‘WPMailSMTP\\Vendor\\SendinBlue\\Client\\Api\\TransactionalEmailsApi’ not found in /wp-content/plugins/wp-mail-smtp/src/Providers/Sendinblue/Api.php:84\nStack trace:\n#0 /wp-content/plugins/wp-mail-smtp/src/Providers/Sendinblue/Mailer.php(309): WPMailSMTP\\Providers\\Sendinblue\\Api->get_smtp_client()\n#1 /wp-content/plugins/wp-mail-smtp/src/MailCatcherV6.php(128): WPMailSMTP\\Providers\\Sendinblue\\Mailer->send()\n#2 /wp-includes/pluggable.php(531): WPMailSMTP\\MailCatcherV6->send()\n#3 /wp-content/plugins/wp-mail-smtp/src/Admin/Pages/TestTab.php(198): wp_mail()\n#4 /wp-content/plugins/wp-mail-smtp/src/Admin/Area.php(869): WPMailSMTP\\Admin\\Pages\\TestTab->process_post()\n#5 /wp-includes/cl…’, referer:

There are multiple solutions to try to make it work.

Updates

The first thing to do if you are stuck with WP Mail SMTP is to ensure that all your WordPress is up to date. You should check your :

  • WordPress
  • Plugins
  • Theme

Once all these updates are done, check back if these errors appear.

Check WP Mail SMTP

Sometimes, you just need to disable the plugin, and enable it just after to make it work again.

If it doesn’t work, your WP Mail SMTP plugin may be corrupted. To ensure that it’s not your case, you have to re-download the plugin (or the theme delivered with the plugin) and try to install it again.

Check others plugins

Are you sure that the error is related to WP Mail SMTP? Maybe not.

It could be related to another plugin that is not compatible. It could happen when you use a cache plugin, a security plugin, or simply a poorly developed plugin.

Disable all plugins. Then, check for your error, if the error is still there, the problem is not related to plugins compatibility. If there are no more errors, then enable every plugin one by one and check for the error. The goal is to target the plugin involved.

Try another theme

The error can be a problem with your theme.

If it’s not already done, then you should install & activate the default WordPress theme like Twenty Twenty-Two. Check for the error, and see what is happening to be sure that your WordPress theme is not the cause.

Permalinks & htaccess

If it doesn’t work, you may have a problem with your WordPress permalinks and/or your htaccess file. You should go on your WordPress dashboard, and re-saving permalinks from the permalinks page.

Contact the developer

If all these solutions don’t work, we advise you to contact the plugin developer.

You may have found a new bug, or a specific issue. You should get in touch with the developer either on the WordPress plugin forum, either by mail, either on their specific website with their own support.

Alternative solutions

If the developer doesn’t reply, or your problem is very urgent, then you should try an alternative to the plugin.

There are thousands of plugins on the official directory, and many others outside. You should try to find and test them!

If the issue is very specific, and the plugin could not be replaced, we advise you to contact an expert.
This is the best way to ensure you're not going to break your site anymore.