updated plugin WP Mail SMTP
version 2.2.1
This commit is contained in:
@ -146,28 +146,19 @@ class Processor {
|
||||
$forced = $options->get( 'mail', 'from_email_force' );
|
||||
$from_email = $options->get( 'mail', 'from_email' );
|
||||
|
||||
if ( ! empty( $reply_to ) ) {
|
||||
if ( ! empty( $reply_to ) || empty( $this->wp_mail_from ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( in_array( $mailer, array( 'gmail', 'outlook' ), true ) ) {
|
||||
if ( $mailer === 'gmail' ) {
|
||||
$forced = true;
|
||||
|
||||
switch ( $mailer ) {
|
||||
case 'gmail':
|
||||
$sender = wp_mail_smtp()->get_providers()->get_auth( 'gmail' )->get_user_info();
|
||||
break;
|
||||
|
||||
case 'outlook':
|
||||
$sender = $options->get( 'outlook', 'user_details' );
|
||||
break;
|
||||
}
|
||||
|
||||
} elseif ( $mailer === 'outlook' ) {
|
||||
$sender = $options->get( 'outlook', 'user_details' );
|
||||
$from_email = ! empty( $sender['email'] ) ? $sender['email'] : '';
|
||||
$forced = true;
|
||||
}
|
||||
|
||||
if (
|
||||
empty( $this->wp_mail_from ) ||
|
||||
$from_email === $this->wp_mail_from ||
|
||||
! $forced
|
||||
) {
|
||||
@ -213,7 +204,7 @@ class Processor {
|
||||
* @since 1.3.0 Forcing email rewrite if option is selected.
|
||||
* @since 1.7.0 Default email may be empty, so pay attention to that as well.
|
||||
*
|
||||
* @param string $wp_email
|
||||
* @param string $wp_email The email address passed by the filter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -222,11 +213,11 @@ class Processor {
|
||||
$options = new Options();
|
||||
$forced = $options->get( 'mail', 'from_email_force' );
|
||||
$from_email = $options->get( 'mail', 'from_email' );
|
||||
$def_email = $this->get_default_email();
|
||||
$def_email = WP::get_default_email();
|
||||
|
||||
// Save the "original" set WP email from address for later use.
|
||||
if ( $wp_email !== $def_email ) {
|
||||
$this->wp_mail_from = $wp_email;
|
||||
$this->wp_mail_from = filter_var( $wp_email, FILTER_VALIDATE_EMAIL );
|
||||
}
|
||||
|
||||
// Return FROM EMAIL if forced in settings.
|
||||
@ -308,7 +299,7 @@ class Processor {
|
||||
*
|
||||
* @since 1.9.0
|
||||
*
|
||||
* @return \WPMailSMTP\MailCatcher
|
||||
* @return MailCatcherInterface
|
||||
*/
|
||||
public function get_phpmailer() {
|
||||
|
||||
@ -316,8 +307,7 @@ class Processor {
|
||||
|
||||
// Make sure the PHPMailer class has been instantiated.
|
||||
if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) {
|
||||
require_once ABSPATH . WPINC . '/class-phpmailer.php';
|
||||
$phpmailer = new MailCatcher( true ); // phpcs:ignore
|
||||
$phpmailer = wp_mail_smtp()->generate_mail_catcher( true ); // phpcs:ignore
|
||||
}
|
||||
|
||||
return $phpmailer;
|
||||
@ -330,7 +320,7 @@ class Processor {
|
||||
*
|
||||
* @since 2.1.1
|
||||
*
|
||||
* @param \PHPMailer $phpmailer The PHPMailer object.
|
||||
* @param MailCatcherInterface $phpmailer The PHPMailer object.
|
||||
*/
|
||||
private function set_default_reply_to( $phpmailer ) {
|
||||
|
||||
|
Reference in New Issue
Block a user