get_label(); } /** * Display the content of the tab. * * @since {1.0.0} */ public function display() { if ( $this->result === self::SUCCESS ) { $this->display_success(); } elseif ( $this->result === self::FAILED ) { $this->display_debug_details(); } elseif ( $this->result === self::FAILED_DOMAIN_CHECK ) { $this->display_domain_check_details(); } else { $this->display_form(); } } /** * Display test email form. * * @since 3.0.0 */ private function display_form() { ?>
is_mailer_complete() && isset( $_GET['auto-start'] ) ) : // phpcs:ignore ?>
|
' . $smtp_debug . ''; } else { $smtp_text .= '[empty]'; } } $errors = apply_filters( 'wp_mail_smtp_admin_test_get_debug_messages', array( $versions_text, $mailer_text, $debug_text, $smtp_text, ) ); return '
' . implode( ''; } /** * Returns debug information for detection, processing, and display. * * @since 1.3.0 * * @return array */ protected function get_debug_details() { $connection_options = $this->connection->get_options(); $smtp_host = $connection_options->get( 'smtp', 'host' ); $smtp_port = $connection_options->get( 'smtp', 'port' ); $smtp_encryption = $connection_options->get( 'smtp', 'encryption' ); $details = [ // [any] - cURL error 60/77. [ 'mailer' => 'any', 'errors' => [ [ 'cURL error 60' ], [ 'cURL error 77' ], ], 'title' => esc_html__( 'SSL certificate issue.', 'wp-mail-smtp' ), 'description' => [ esc_html__( 'This means your web server cannot reliably make secure connections (make requests to HTTPS sites).', 'wp-mail-smtp' ), esc_html__( 'Typically this error is returned when web server is not configured properly.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Contact your web hosting provider and inform them your site has an issue with SSL certificates.', 'wp-mail-smtp' ), esc_html__( 'The exact error you can provide them is in the Error log, available at the bottom of this page.', 'wp-mail-smtp' ), esc_html__( 'Ask them to resolve the issue then try again.', 'wp-mail-smtp' ), ], ], // [any] - cURL error 6/7. [ 'mailer' => 'any', 'errors' => [ [ 'cURL error 6' ], [ 'cURL error 7' ], ], 'title' => esc_html__( 'Could not connect to host.', 'wp-mail-smtp' ), 'description' => [ ! empty( $smtp_host ) ? sprintf( /* translators: %s - SMTP host address. */ esc_html__( 'This means your web server was unable to connect to %s.', 'wp-mail-smtp' ), $smtp_host ) : esc_html__( 'This means your web server was unable to connect to the host server.', 'wp-mail-smtp' ), esc_html__( 'Typically this error is returned your web server is blocking the connections or the SMTP host denying the request.', 'wp-mail-smtp' ), ], 'steps' => [ sprintf( /* translators: %s - SMTP host address. */ esc_html__( 'Contact your web hosting provider and ask them to verify your server can connect to %s. Additionally, ask them if a firewall or security policy may be preventing the connection.', 'wp-mail-smtp' ), $smtp_host ), esc_html__( 'If using "Other SMTP" Mailer, triple check your SMTP settings including host address, email, and password.', 'wp-mail-smtp' ), esc_html__( 'If using "Other SMTP" Mailer, contact your SMTP host to confirm they are accepting outside connections with the settings you have configured (address, username, port, security, etc).', 'wp-mail-smtp' ), ], ], // [sendgrid] - cURL error 18 - potential incorrect API key. [ 'mailer' => 'sendgrid', 'errors' => [ [ 'cURL error 18' ], ], 'title' => esc_html__( 'Invalid SendGrid API key', 'wp-mail-smtp' ), 'description' => [ esc_html__( 'It looks like your SendGrid API Key is invalid.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Go to WP Mail SMTP plugin Settings page.', 'wp-mail-smtp' ), esc_html__( 'Make sure your API Key in the SendGrid mailer settings is correct and valid.', 'wp-mail-smtp' ), esc_html__( 'Save the plugin settings.', 'wp-mail-smtp' ), esc_html__( 'If updating the API Key doesn\'t resolve this issue, please contact our support.', 'wp-mail-smtp' ), ], ], // [any] - cURL error XX (other). [ 'mailer' => 'any', 'errors' => [ [ 'cURL error' ], ], 'title' => esc_html__( 'Could not connect to your host.', 'wp-mail-smtp' ), 'description' => [ ! empty( $smtp_host ) ? sprintf( /* translators: %s - SMTP host address. */ esc_html__( 'This means your web server was unable to connect to %s.', 'wp-mail-smtp' ), $smtp_host ) : esc_html__( 'This means your web server was unable to connect to the host server.', 'wp-mail-smtp' ), esc_html__( 'Typically this error is returned when web server is not configured properly.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Contact your web hosting provider and inform them you are having issues making outbound connections.', 'wp-mail-smtp' ), esc_html__( 'The exact error you can provide them is in the Error log, available at the bottom of this page.', 'wp-mail-smtp' ), esc_html__( 'Ask them to resolve the issue then try again.', 'wp-mail-smtp' ), ], ], // [smtp] - SMTP Error: Count not authenticate. [ 'mailer' => 'smtp', 'errors' => [ [ 'SMTP Error: Could not authenticate.' ], ], 'title' => esc_html__( 'Could not authenticate your SMTP account.', 'wp-mail-smtp' ), 'description' => [ esc_html__( 'This means we were able to connect to your SMTP host, but were not able to proceed using the email/password in the settings.', 'wp-mail-smtp' ), esc_html__( 'Typically this error is returned when the email or password is not correct or is not what the SMTP host is expecting.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Triple check your SMTP settings including host address, email, and password. If you have recently reset your password you will need to update the settings.', 'wp-mail-smtp' ), esc_html__( 'Contact your SMTP host to confirm you are using the correct username and password.', 'wp-mail-smtp' ), esc_html__( 'Verify with your SMTP host that your account has permissions to send emails using outside connections.', 'wp-mail-smtp' ), sprintf( wp_kses( /* translators: %s - URL to the wpmailsmtp.com doc page. */ __( 'Visit our documentation for additional tips on how to resolve this error.', 'wp-mail-smtp' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/how-to-set-up-the-other-smtp-mailer-in-wp-mail-smtp/#auth-type', [ 'medium' => 'email-test', 'content' => 'Other SMTP auth debug - our documentation' ] ) ) ), ], ], // [smtp] - Sending bulk email, hitting rate limit. [ 'mailer' => 'smtp', 'errors' => [ [ 'We do not authorize the use of this system to transport unsolicited' ], ], 'title' => esc_html__( 'Error due to unsolicited and/or bulk e-mail.', 'wp-mail-smtp' ), 'description' => [ esc_html__( 'This means the connection to your SMTP host was made successfully, but the host rejected the email.', 'wp-mail-smtp' ), esc_html__( 'Typically this error is returned when you are sending too many e-mails or e-mails that have been identified as spam.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Make sure you are not sending emails with too many recipients. Example: single email should not have 10+ recipients. You can install any WordPress e-mail logging plugin to check your recipients (TO, CC and BCC).', 'wp-mail-smtp' ), esc_html__( 'Contact your SMTP host to ask about sending/rate limits.', 'wp-mail-smtp' ), esc_html__( 'Verify with them your SMTP account is in good standing and your account has not been flagged.', 'wp-mail-smtp' ), ], ], // [smtp] - Unauthenticated senders not allowed. [ 'mailer' => 'smtp', 'errors' => [ [ 'Unauthenticated senders not allowed' ], ], 'title' => esc_html__( 'Unauthenticated senders are not allowed.', 'wp-mail-smtp' ), 'description' => [ esc_html__( 'This means the connection to your SMTP host was made successfully, but you should enable Authentication and provide correct Username and Password.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Go to WP Mail SMTP plugin Settings page.', 'wp-mail-smtp' ), esc_html__( 'Enable Authentication', 'wp-mail-smtp' ), esc_html__( 'Enter correct SMTP Username (usually this is an email address) and Password in the appropriate fields.', 'wp-mail-smtp' ), ], ], // [smtp] - certificate verify failed. // Has to be defined before "SMTP connect() failed" error, since this is a more specific error, // which contains the "SMTP connect() failed" error message as well. [ 'mailer' => 'smtp', 'errors' => [ [ 'certificate verify failed' ], ], 'title' => esc_html__( 'Misconfigured server certificate.', 'wp-mail-smtp' ), 'description' => [ esc_html__( 'This means OpenSSL on your server isn\'t able to verify the host certificate.', 'wp-mail-smtp' ), esc_html__( 'There are a few reasons why this is happening. It could be that the host certificate is misconfigured, or this server\'s OpenSSL is using an outdated CA bundle.', 'wp-mail-smtp' ), ], 'steps' => [ esc_html__( 'Verify that the host\'s SSL certificate is valid.', 'wp-mail-smtp' ), sprintf( wp_kses( /* translators: %s - URL to the PHP openssl manual */ __( 'Contact your hosting support, show them the "full Error Log for debugging" below and share this link with them.', 'wp-mail-smtp' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), 'https://www.php.net/manual/en/migration56.openssl.php' ), ], ], // [smtp] - SMTP connect() failed. [ 'mailer' => 'smtp', 'errors' => [ [ 'SMTP connect() failed' ], ], 'title' => esc_html__( 'Could not connect to the SMTP host.', 'wp-mail-smtp' ), 'description' => [ ! empty( $smtp_host ) ? sprintf( /* translators: %s - SMTP host address. */ esc_html__( 'This means your web server was unable to connect to %s.', 'wp-mail-smtp' ), $smtp_host ) : esc_html__( 'This means your web server was unable to connect to the host server.', 'wp-mail-smtp' ), esc_html__( 'Typically this error is returned for one of the following reasons:', 'wp-mail-smtp' ), '
', array_filter( $errors ) ) . '
info@example.com
',
'info@localhost
, info@192.168.1.1
'
),
esc_html__( 'Make sure that the generated email has a TO header, useful when you are responsible for email creation.', 'wp-mail-smtp' ),
],
],
// [gmail] - Token has been expired or revoked.
[
'mailer' => 'gmail',
'errors' => [
[ 'invalid_grant', 'Token has been expired or revoked' ],
],
'title' => esc_html__( 'Google API Error.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'Unfortunately, this error can be due to many different reasons.', 'wp-mail-smtp' ),
sprintf(
wp_kses( /* translators: %s - Blog article URL. */
__( 'Please read this article to learn more about what can cause this error and follow the steps below.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'target' => [],
'rel' => [],
],
]
),
'https://blog.timekit.io/google-oauth-invalid-grant-nightmare-and-how-to-fix-it-9f4efaf1da35'
),
],
'steps' => [
esc_html__( 'Go to WP Mail SMTP plugin settings page. Click the “Remove OAuth Connection” button.', 'wp-mail-smtp' ),
esc_html__( 'Then click the “Allow plugin to send emails using your Google account” button and re-enable access.', 'wp-mail-smtp' ),
],
],
// [gmail] - Code was already redeemed.
[
'mailer' => 'gmail',
'errors' => [
[ 'invalid_grant', 'Code was already redeemed' ],
],
'title' => esc_html__( 'Google API Error.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'Authentication code that Google returned to you has already been used on your previous auth attempt.', 'wp-mail-smtp' ),
],
'steps' => [
esc_html__( 'Make sure that you are not trying to manually clean up the plugin options to retry the "Allow..." step.', 'wp-mail-smtp' ),
esc_html__( 'Reinstall the plugin with clean plugin data turned on on Misc page. This will remove all the plugin options and you will be safe to retry.', 'wp-mail-smtp' ),
esc_html__( 'Make sure there is no aggressive caching on site admin area pages or try to clean cache between attempts.', 'wp-mail-smtp' ),
],
],
// [gmail] - 400: Mail service not enabled.
[
'mailer' => 'gmail',
'errors' => [
[ '400', 'Mail service not enabled' ],
],
'title' => esc_html__( 'Google API Error.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'There are various reasons for that, please review the steps below.', 'wp-mail-smtp' ),
],
'steps' => [
sprintf(
wp_kses( /* translators: %s - Google Workspace Admin area URL. */
__( 'Make sure that your Google Workspace trial period has not expired. You can check the status here.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
'https://admin.google.com'
),
sprintf(
wp_kses( /* translators: %s - Google Workspace Admin area URL. */
__( 'Make sure that Gmail app in your Google Workspace is actually enabled. You can check that in Apps list in Google Workspace Admin area.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
'https://admin.google.com'
),
sprintf(
wp_kses( /* translators: %s - Google Developers Console URL. */
__( 'Make sure that you have Gmail API enabled, and you can do that here.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
'https://console.developers.google.com/'
),
],
],
// [gmail] - 403: Project X is not found and cannot be used for API calls.
[
'mailer' => 'gmail',
'errors' => [
[ '403', 'is not found and cannot be used for API calls' ],
],
'title' => esc_html__( 'Google API Error.', 'wp-mail-smtp' ),
'description' => [],
'steps' => [
esc_html__( 'Make sure that the used Client ID/Secret correspond to a proper project that has Gmail API enabled.', 'wp-mail-smtp' ),
sprintf(
wp_kses( /* translators: %s - Gmail documentation URL. */
esc_html__( 'Please follow our Gmail tutorial to be sure that all the correct project and data is applied.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
// phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/how-to-set-up-the-gmail-mailer-in-wp-mail-smtp/', [ 'medium' => 'email-test', 'content' => 'Gmail tutorial' ] ) )
),
],
],
// [gmail] - The OAuth client was disabled.
[
'mailer' => 'gmail',
'errors' => [
[ 'disabled_client', 'The OAuth client was disabled' ],
],
'title' => esc_html__( 'Google API Error.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'You may have added a new API to a project', 'wp-mail-smtp' ),
],
'steps' => [
esc_html__( 'Make sure that the used Client ID/Secret correspond to a proper project that has Gmail API enabled.', 'wp-mail-smtp' ),
esc_html__( 'Try to use a separate project for your emails, so the project has only 1 Gmail API in it enabled. You will need to remove the old project and create a new one from scratch.', 'wp-mail-smtp' ),
],
],
// [SMTP.com] - The "channel - not found" issue.
[
'mailer' => 'smtpcom',
'errors' => [
[ 'channel - not found' ],
],
'title' => esc_html__( 'SMTP.com API Error.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'Your Sender Name option is incorrect.', 'wp-mail-smtp' ),
],
'steps' => [
esc_html__( 'Please make sure you entered an accurate Sender Name in WP Mail SMTP plugin settings.', 'wp-mail-smtp' ),
],
],
// [gmail] - GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler.
[
'mailer' => 'gmail',
'errors' => [
[ 'GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler' ],
],
'title' => esc_html__( 'GuzzleHttp requirements.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler.', 'wp-mail-smtp' ),
],
'steps' => [
esc_html__( 'Edit your php.ini file on your hosting server.', 'wp-mail-smtp' ),
esc_html__( '(Recommended) Enable PHP extension: cURL, by adding "extension=curl" to the php.ini file (without the quotation marks) OR', 'wp-mail-smtp' ),
esc_html__( '(If cURL can\'t be enabled on your hosting server) Enable PHP setting: allow_url_fopen, by adding "allow_url_fopen = On" to the php.ini file (without the quotation marks)', 'wp-mail-smtp' ),
esc_html__( 'If you don\'t know how to do the above we strongly suggest contacting your hosting support and provide them the "full Error Log for debugging" below and these steps. They should be able to fix this issue for you.', 'wp-mail-smtp' ),
],
],
// [sparkpost] - Forbidden.
[
'mailer' => 'sparkpost',
'errors' => [
[ 'Forbidden' ],
],
'title' => esc_html__( 'SparkPost API failed.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'Typically this error occurs because there is an issue with your SparkPost settings, in many cases an incorrect API key.', 'wp-mail-smtp' ),
],
'steps' => [
sprintf(
wp_kses( /* translators: %1$s - SparkPost API Keys area URL, %1$s - SparkPost EU API Keys area URL. */
__( 'Go to your SparkPost account or SparkPost EU account and verify that your API key is correct.', 'wp-mail-smtp' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
'b' => [],
]
),
'https://app.sparkpost.com/account/api-keys',
'https://app.eu.sparkpost.com/account/api-keys'
),
esc_html__( 'Verify that your API key has "Transmissions: Read/Write" permission.', 'wp-mail-smtp' ),
],
],
// [sparkpost] - Unauthorized.
[
'mailer' => 'sparkpost',
'errors' => [
[ 'Unauthorized' ],
],
'title' => esc_html__( 'SparkPost API failed.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'Typically this error occurs because there is an issue with your SparkPost settings, in many cases an incorrect region.', 'wp-mail-smtp' ),
],
'steps' => [
esc_html__( 'Verify that your SparkPost account region is selected in WP Mail SMTP settings.', 'wp-mail-smtp' ),
],
],
];
/**
* [any] - PHP 7.4.x and PCRE library issues.
*
* @see https://wordpress.org/support/topic/cant-send-emails-using-php-7-4/
*/
if (
version_compare( phpversion(), '7.4', '>=' ) &&
defined( 'PCRE_VERSION' ) &&
version_compare( PCRE_VERSION, '10.0', '>' ) &&
version_compare( PCRE_VERSION, '10.32', '<=' )
) {
$details[] = [
'mailer' => 'any',
'errors' => [
[ 'Invalid address: (setFrom)' ],
],
'title' => esc_html__( 'PCRE library issue', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'It looks like your server is running PHP version 7.4.x with an outdated PCRE library (libpcre2) that has a known issue with email address validation.', 'wp-mail-smtp' ),
esc_html__( 'There is a known issue with PHP version 7.4.x, when using libpcre2 library version lower than 10.33.', 'wp-mail-smtp' ),
],
'steps' => [
esc_html__( 'Contact your web hosting provider and inform them you are having issues with libpcre2 library on PHP 7.4.', 'wp-mail-smtp' ),
esc_html__( 'They should be able to resolve this issue for you.', 'wp-mail-smtp' ),
esc_html__( 'For a quick fix, until your web hosting resolves this, you can downgrade to PHP version 7.3 on your server.', 'wp-mail-smtp' ),
],
];
}
// Error detection logic.
foreach ( $details as $data ) {
// Check for appropriate mailer.
if ( 'any' !== $data['mailer'] && $this->debug['mailer'] !== $data['mailer'] ) {
continue;
}
$match = false;
// Attempt to detect errors.
foreach ( $data['errors'] as $error_group ) {
foreach ( $error_group as $error_message ) {
$match = false !== strpos( $this->debug['error_log'], $error_message );
if ( ! $match ) {
break;
}
}
if ( $match ) {
break;
}
}
if ( $match ) {
return $data;
}
}
// Return defaults.
return [
'title' => esc_html__( 'An issue was detected.', 'wp-mail-smtp' ),
'description' => [
esc_html__( 'This means your test email was unable to be sent.', 'wp-mail-smtp' ),
esc_html__( 'Typically this error is returned for one of the following reasons:', 'wp-mail-smtp' ),
'submit a support ticket.', 'wp-mail-smtp' ), array( 'a' => array( 'href' => array(), 'rel' => array(), 'target' => array(), ), ) ), // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/account/support/', [ 'medium' => 'email-test', 'content' => 'submit a support ticket' ] ) ) ); ?>
upgrade to WP Mail SMTP Pro. Along with getting expert support, you will also get Notification controls, Email Logging, and integrations for Amazon SES, Office 365, and Outlook.com.', 'wp-mail-smtp' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ), esc_url( wp_mail_smtp()->get_upgrade_link( 'email-test-fail' ) ) ) ?>
%s off regular pricing, automatically applied at checkout!', 'wp-mail-smtp' ), array( 'span' => array( 'class' => array(), ), ) ), '$50' ); ?>
limited support on the WordPress.org support forums. You can create a support thread there, but please understand that free support is not guaranteed and is limited to simple issues. If you have an urgent or complex issue, then please consider upgrading to WP Mail SMTP Pro to access our priority support ticket system.', 'wp-mail-smtp' ), array( 'a' => array( 'href' => array(), 'rel' => array(), 'target' => array(), ), ) ), 'https://wordpress.org/support/topic/wp-mail-smtp-support-policy/', 'https://wordpress.org/support/plugin/wp-mail-smtp/', esc_url( wp_mail_smtp()->get_upgrade_link( 'email-test-fail' ) ) ); ?>