diff options
-rw-r--r-- | Postman/Postman-Configuration/PostmanConfigurationController.php | 12 | ||||
-rw-r--r-- | Postman/Postman-Mail/PostmanMessage.php | 7 | ||||
-rw-r--r-- | Postman/PostmanInputSanitizer.php | 1 | ||||
-rw-r--r-- | Postman/PostmanOptions.php | 15 | ||||
-rw-r--r-- | postman-smtp.php | 4 | ||||
-rw-r--r-- | readme.txt | 7 |
6 files changed, 36 insertions, 10 deletions
diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php index 1e5b0a3..bc9c274 100644 --- a/Postman/Postman-Configuration/PostmanConfigurationController.php +++ b/Postman/Postman-Configuration/PostmanConfigurationController.php @@ -301,6 +301,18 @@ class PostmanConfigurationController { </td> </tr> + <tr> + <th scope="row"><?php _e('From Email', Postman::TEXT_DOMAIN ); ?></th> + <td> + <input type="email" id="fallback-smtp-from-email" + value="<?php echo $this->options->getFallbackFromEmail(); ?>" + name="postman_options[<?php echo PostmanOptions::FALLBACK_FROM_EMAIL; ?>]" + > + <br> + <small><?php _e( "Use allowed email, for example: If you are using Gmail, type your Gmail adress.", Postman::TEXT_DOMAIN ); ?></small> + </td> + </tr> + <tr valign=""> <th scope="row"><?php _e( 'Use SMTP Authentication?', Postman::TEXT_DOMAIN ); ?></th> <td> diff --git a/Postman/Postman-Mail/PostmanMessage.php b/Postman/Postman-Mail/PostmanMessage.php index a85687e..2af67ef 100644 --- a/Postman/Postman-Mail/PostmanMessage.php +++ b/Postman/Postman-Mail/PostmanMessage.php @@ -228,6 +228,13 @@ if ( ! class_exists( 'PostmanMessage' ) ) { $this->logger->debug( sprintf( 'Forced From email address: before=%s after=%s', $this->getFromAddress()->getEmail(), $forcedEmailAddress ) ); $this->getFromAddress()->setEmail( $forcedEmailAddress ); } + + if ( $options->is_fallback ) { + $fallback_email = $options->getFallbackFromEmail(); + $this->logger->debug( sprintf( 'Fallback: Forced From email address: before=%s after=%s', $this->getFromAddress()->getEmail(), $fallback_email ) ); + $this->getFromAddress()->setEmail( $fallback_email ); + } + $forcedEmailName = $options->getMessageSenderName(); if ( $options->isSenderNameOverridePrevented() && $this->getFromAddress()->getName() !== $forcedEmailName ) { $this->logger->debug( sprintf( 'Forced From email name: before=%s after=%s', $this->getFromAddress()->getName(), $forcedEmailName ) ); diff --git a/Postman/PostmanInputSanitizer.php b/Postman/PostmanInputSanitizer.php index d2b01ae..6a4f442 100644 --- a/Postman/PostmanInputSanitizer.php +++ b/Postman/PostmanInputSanitizer.php @@ -85,6 +85,7 @@ if ( ! class_exists( 'PostmanInputSanitizer' ) ) { $this->sanitizeInt( 'Fallback port', PostmanOptions::FALLBACK_SMTP_PORT, $input, $new_input ); $this->sanitizeString( 'Fallback security', PostmanOptions::FALLBACK_SMTP_SECURITY, $input, $new_input ); $this->sanitizeString( 'Fallback auth', PostmanOptions::FALLBACK_SMTP_USE_AUTH, $input, $new_input ); + $this->sanitizeString( 'Fallback username', PostmanOptions::FALLBACK_FROM_EMAIL, $input, $new_input ); $this->sanitizeString( 'Fallback username', PostmanOptions::FALLBACK_SMTP_USERNAME, $input, $new_input ); $this->sanitizePassword( 'Fallback password', PostmanOptions::FALLBACK_SMTP_PASSWORD, $input, $new_input, $this->options->getFallbackPassword() ); diff --git a/Postman/PostmanOptions.php b/Postman/PostmanOptions.php index 8825681..b6eaaf4 100644 --- a/Postman/PostmanOptions.php +++ b/Postman/PostmanOptions.php @@ -118,6 +118,7 @@ if ( ! class_exists( 'PostmanOptions' ) ) { const FALLBACK_SMTP_HOSTNAME = 'fallback_smtp_hostname'; const FALLBACK_SMTP_PORT = 'fallback_smtp_port'; const FALLBACK_SMTP_SECURITY = 'fallback_smtp_security'; + const FALLBACK_FROM_EMAIL = 'fallback_from_email'; const FALLBACK_SMTP_USE_AUTH = 'fallback_smtp_use_auth'; const FALLBACK_SMTP_USERNAME = 'fallback_smtp_username'; const FALLBACK_SMTP_PASSWORD = 'fallback_smtp_password'; @@ -286,7 +287,7 @@ if ( ! class_exists( 'PostmanOptions' ) ) { public function getEnvelopeSender() { if ( $this->is_fallback ) { - return $this->getFallbackUsername(); + return $this->getFallbackFromEmail(); } if ( isset( $this->options [ PostmanOptions::ENVELOPE_SENDER ] ) ) { @@ -296,12 +297,18 @@ if ( ! class_exists( 'PostmanOptions' ) ) { public function getMessageSenderEmail() { if ( $this->is_fallback ) { - return $this->getFallbackUsername(); + return $this->getFallbackFromEmail(); } if ( isset( $this->options [ PostmanOptions::MESSAGE_SENDER_EMAIL ] ) ) { return $this->options [ PostmanOptions::MESSAGE_SENDER_EMAIL ]; } } + + public function getFallbackFromEmail() { + if ( isset( $this->options [ PostmanOptions::FALLBACK_FROM_EMAIL ] ) ) { + return $this->options [ PostmanOptions::FALLBACK_FROM_EMAIL ]; } + } + public function getMessageSenderName() { if ( isset( $this->options [ PostmanOptions::MESSAGE_SENDER_NAME ] ) ) { return $this->options [ PostmanOptions::MESSAGE_SENDER_NAME ]; } @@ -534,10 +541,6 @@ if ( ! class_exists( 'PostmanOptions' ) ) { return $this->isPluginSenderEmailEnforced(); } public function isPluginSenderEmailEnforced() { - - if ( $this->is_fallback ) { - return true; - } if ( $this->isNew() ) { return self::DEFAULT_PLUGIN_MESSAGE_SENDER_EMAIL_ENFORCED; } diff --git a/postman-smtp.php b/postman-smtp.php index d6a2ee3..0b486c8 100644 --- a/postman-smtp.php +++ b/postman-smtp.php @@ -3,7 +3,7 @@ * Plugin Name: Post SMTP * Plugin URI: https://wordpress.org/plugins/post-smtp/ * Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes! - * Version: 1.9.7 + * Version: 1.9.8 * Author: Yehuda Hassine * Text Domain: post-smtp * Author URI: https://postmansmtp.com @@ -126,5 +126,5 @@ function post_start( $startingMemory ) { */ function post_setupPostman() { require_once 'Postman/Postman.php'; - $kevinCostner = new Postman( __FILE__, '1.9.7' ); + $kevinCostner = new Postman( __FILE__, '1.9.8' ); } @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun Requires at least: 3.9 Tested up to: 5.0.3 -Stable tag: 1.9.7 +Stable tag: 1.9.8 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -12,7 +12,7 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP == Description == -= Version 1.9.7 released - The SMTP Fallback = += Version 1.9.8 released - The SMTP Fallback = A fallback is a unique solution only exist on Post SMTP. You can configure a backup SMTP, so if your emails are failing your site will keep sending emails !!! [Read the detailes here](https://postmansmtp.com/post-smtp-1-9-7-the-smtp-fallback/) @@ -290,6 +290,9 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a == Changelog == += 1.9.8 - 2019-02-18 +* New: a new from field to the fallback - Can't trust the username as "from" value (email address). + = 1.9.7 - 2019-02-17 * New: Fallback Feature - Configure a backup SMTP when emails are failing. * New: WordPress Multisite compability - with global settings. |