updated plugin SMTP Mailer version 1.1.3

This commit is contained in:
2022-03-21 13:35:11 +00:00
committed by Gitium
parent a9ffa6605d
commit 71c1e3409e
2 changed files with 29 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
Plugin Name: SMTP Mailer
Version: 1.1.2
Version: 1.1.3
Plugin URI: https://wphowto.net/smtp-mailer-plugin-for-wordpress-1482
Author: naa986
Author URI: https://wphowto.net/
@ -16,8 +16,8 @@ if (!defined('ABSPATH')){
class SMTP_MAILER {
var $plugin_version = '1.1.2';
var $phpmailer_version = '6.3.0';
var $plugin_version = '1.1.3';
var $phpmailer_version = '6.5.3';
var $plugin_url;
var $plugin_path;
@ -796,13 +796,28 @@ function smtp_mailer_pre_wp_mail($null, $atts)
*/
do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
$mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
// Send!
try {
return $phpmailer->send();
} catch ( PHPMailer\PHPMailer\Exception $e ) {
$send = $phpmailer->send();
$mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
$mail_error_data['phpmailer_exception_code'] = $e->getCode();
/**
* Fires after PHPMailer has successfully sent a mail.
*
* The firing of this action does not necessarily mean that the recipient received the
* email successfully. It only means that the `send` method above was able to
* process the request without any errors.
*
* @since 5.9.0
*
* @param array $mail_data An array containing the mail recipient, subject, message, headers, and attachments.
*/
do_action( 'wp_mail_succeeded', $mail_data );
return $send;
} catch ( PHPMailer\PHPMailer\Exception $e ) {
$mail_data['phpmailer_exception_code'] = $e->getCode();
/**
* Fires after a PHPMailer\PHPMailer\Exception is caught.
@ -812,7 +827,7 @@ function smtp_mailer_pre_wp_mail($null, $atts)
* @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array
* containing the mail recipient, subject, message, headers, and attachments.
*/
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) );
return false;
}