diff options
Diffstat (limited to 'Postman')
-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 |
4 files changed, 29 insertions, 6 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; } |