updated plugin `SMTP Mailer` version 1.1.3

This commit is contained in:
KawaiiPunk 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;
}

View File

@ -2,9 +2,9 @@
Contributors: naa986
Donate link: https://wphowto.net/
Tags: email, mail, smtp, phpmailer
Requires at least: 5.7
Tested up to: 5.8
Stable tag: 1.1.2
Requires at least: 5.9
Tested up to: 5.9
Stable tag: 1.1.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -16,10 +16,6 @@ Configure a SMTP server to send email from your WordPress site. Configure the wp
https://www.youtube.com/watch?v=7O_jgtykcEk&rel=0
=== Requirements ===
* A self-hosted website running on [WordPress hosting](https://wphowto.net/best-cheap-wordpress-hosting-1689)
=== SMTP Mailer Settings ===
* **SMTP Host**: Your outgoing mail server (e.g. smtp.gmail.com).
@ -107,6 +103,9 @@ none
== Changelog ==
= 1.1.3 =
* Updated the mail function for WordPress 5.9.
= 1.1.2 =
* Fixed an issue that could cause an Undefined variable error if $attachments was not set.