esc_html__( 'Is WP Mail SMTP mailer setup complete?', 'wp-mail-smtp' ), 'test' => array( $this, 'mailer_setup_complete_test' ), ); return $tests; } /** * Register plugin WP Site Health debug information. * This will be displayed in the "Info" tab of the WP Site Health page. * * @since {VERSION} * * @param array $debug_info Array of existing debug information. * * @return array */ public function register_debug_information( $debug_info ) { $debug_notices = Debug::get(); $debug_info[ self::DEBUG_INFO_SLUG ] = array( 'label' => $this->get_label(), 'fields' => array( 'version' => array( 'label' => esc_html__( 'Version', 'wp-mail-smtp' ), 'value' => WPMS_PLUGIN_VER, ), 'license_key_type' => array( 'label' => esc_html__( 'License key type', 'wp-mail-smtp' ), 'value' => wp_mail_smtp()->get_license_type(), ), 'debug' => array( 'label' => esc_html__( 'Debug', 'wp-mail-smtp' ), 'value' => ! empty( $debug_notices ) ? implode( '. ', $debug_notices ) : esc_html__( 'No debug notices found.', 'wp-mail-smtp' ), ), ), ); return $debug_info; } /** * Perform the WP site health test for checking, if the mailer setup is complete. * * @since {VERSION} */ public function mailer_setup_complete_test() { $mailer = Options::init()->get( 'mail', 'mailer' ); $mailer_complete = wp_mail_smtp() ->get_providers() ->get_mailer( $mailer, wp_mail_smtp()->get_processor()->get_phpmailer() )->is_mailer_complete(); // The default mailer should be considered as a non-complete mailer. if ( $mailer === 'mail' ) { $mailer_complete = false; } $mailer_text = sprintf( '%s: %s', esc_html__( 'Current mailer', 'wp-mail-smtp' ), esc_html( wp_mail_smtp()->get_providers()->get_options( $mailer )->get_title() ) ); $result = array( 'label' => esc_html__( 'WP Mail SMTP mailer setup is complete', 'wp-mail-smtp' ), 'status' => 'good', 'badge' => array( 'label' => $this->get_label(), 'color' => self::BADGE_COLOR, ), 'description' => sprintf( '

%s

%s

', $mailer_text, esc_html__( 'The WP Mail SMTP plugin mailer setup is complete. You can send a test email, to make sure it\'s working properly.', 'wp-mail-smtp' ) ), 'actions' => sprintf( '

%s

', esc_url( add_query_arg( 'tab', 'test', wp_mail_smtp()->get_admin()->get_admin_page_url() ) ), esc_html__( 'Test email sending', 'wp-mail-smtp' ) ), 'test' => 'wp_mail_smtp_mailer_setup_complete', ); if ( $mailer === 'mail' ) { $mailer_text .= sprintf( /* translators: %s - explanation why default mailer is not a valid mailer option. */ '

%s

', esc_html__( 'You currently have the default mailer selected, which means that you haven’t set up SMTP yet.', 'wp-mail-smtp' ) ); } if ( $mailer_complete === false ) { $result['label'] = esc_html__( 'WP Mail SMTP mailer setup is incomplete', 'wp-mail-smtp' ); $result['status'] = 'recommended'; $result['badge']['color'] = 'orange'; $result['description'] = sprintf( '

%s

%s

', $mailer_text, esc_html__( 'The WP Mail SMTP plugin mailer setup is incomplete. Please click on the link below to access plugin settings and configure the mailer.', 'wp-mail-smtp' ) ); $result['actions'] = sprintf( '

%s

', esc_url( wp_mail_smtp()->get_admin()->get_admin_page_url() ), esc_html__( 'Configure mailer', 'wp-mail-smtp' ) ); } return $result; } }