updated plugin SMTP Mailer version 1.1.1

This commit is contained in:
KawaiiPunk 2021-03-22 16:13:15 +00:00 committed by Gitium
parent a366a73cba
commit a27d917629
2 changed files with 376 additions and 388 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
Plugin Name: SMTP Mailer Plugin Name: SMTP Mailer
Version: 1.1.0 Version: 1.1.1
Plugin URI: https://wphowto.net/smtp-mailer-plugin-for-wordpress-1482 Plugin URI: https://wphowto.net/smtp-mailer-plugin-for-wordpress-1482
Author: naa986 Author: naa986
Author URI: https://wphowto.net/ Author URI: https://wphowto.net/
@ -16,8 +16,8 @@ if (!defined('ABSPATH')){
class SMTP_MAILER { class SMTP_MAILER {
var $plugin_version = '1.1.0'; var $plugin_version = '1.1.1';
var $phpmailer_version = '6.1.6'; var $phpmailer_version = '6.3.0';
var $plugin_url; var $plugin_url;
var $plugin_path; var $plugin_path;
@ -42,6 +42,7 @@ class SMTP_MAILER {
add_action('plugins_loaded', array($this, 'plugins_loaded_handler')); add_action('plugins_loaded', array($this, 'plugins_loaded_handler'));
add_action('admin_menu', array($this, 'options_menu')); add_action('admin_menu', array($this, 'options_menu'));
add_action('admin_notices', 'smtp_mailer_admin_notice'); add_action('admin_notices', 'smtp_mailer_admin_notice');
add_filter('pre_wp_mail', 'smtp_mailer_pre_wp_mail', 10, 2);
} }
function plugins_loaded_handler() function plugins_loaded_handler()
@ -442,21 +443,8 @@ function is_smtp_mailer_configured() {
$GLOBALS['smtp_mailer'] = new SMTP_MAILER(); $GLOBALS['smtp_mailer'] = new SMTP_MAILER();
if(!function_exists('wp_mail') && is_smtp_mailer_configured()){ function smtp_mailer_pre_wp_mail($null, $atts)
{
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
// Compact the input, apply the filters, and extract them back out.
/**
* Filters the wp_mail() arguments.
*
* @since 2.2.0
*
* @param array $args A compacted array of wp_mail() arguments, including the "to" email,
* subject, message, headers, and attachments values.
*/
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
if ( isset( $atts['to'] ) ) { if ( isset( $atts['to'] ) ) {
$to = $atts['to']; $to = $atts['to'];
} }
@ -696,7 +684,7 @@ if(!function_exists('wp_mail') && is_smtp_mailer_configured()){
} }
// Tell PHPMailer to use SMTP // Tell PHPMailer to use SMTP
$phpmailer->isSMTP(); //$phpmailer->IsMail(); $phpmailer->isSMTP(); //$phpmailer->isMail();
// Set the hostname of the mail server // Set the hostname of the mail server
$phpmailer->Host = $options['smtp_host']; $phpmailer->Host = $options['smtp_host'];
// Whether to use SMTP authentication // Whether to use SMTP authentication
@ -735,7 +723,6 @@ if(!function_exists('wp_mail') && is_smtp_mailer_configured()){
) )
); );
} }
// Set Content-Type and charset. // Set Content-Type and charset.
// If we don't have a content-type from the input headers. // If we don't have a content-type from the input headers.
@ -831,5 +818,3 @@ if(!function_exists('wp_mail') && is_smtp_mailer_configured()){
return false; return false;
} }
} }
}

View File

@ -2,9 +2,9 @@
Contributors: naa986 Contributors: naa986
Donate link: https://wphowto.net/ Donate link: https://wphowto.net/
Tags: email, mail, smtp, phpmailer Tags: email, mail, smtp, phpmailer
Requires at least: 5.5 Requires at least: 5.7
Tested up to: 5.7 Tested up to: 5.7
Stable tag: 1.1.0 Stable tag: 1.1.1
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -107,6 +107,9 @@ none
== Changelog == == Changelog ==
= 1.1.1 =
* WordPress 5.7 compatibility update.
= 1.1.0 = = 1.1.0 =
* The password field can be left empty when updating the settings. * The password field can be left empty when updating the settings.