From 27a954e77dabd83914ebdf66ab8e3cb3828662db Mon Sep 17 00:00:00 2001 From: Piotr Potrebka <piotr.potrebka@wpdesk.net> Date: Thu, 9 Feb 2023 09:22:35 +0100 Subject: [PATCH] feat: email styles --- src/Mailer.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Mailer.php b/src/Mailer.php index 306dc5c..be4ce75 100644 --- a/src/Mailer.php +++ b/src/Mailer.php @@ -131,16 +131,19 @@ class Mailer { continue; } if ( $email->get_is_enable() ) { + $mailer_from = $this->get_from(); add_filter( 'wp_mail_from', - $from_cb = static function ( $from ) { - return $this->get_from(); + $from_cb = static function ( $from ) use ( $mailer_from ) { + return $mailer_from; } ); + + $mailer_from_name = $this->get_from_name(); add_filter( 'wp_mail_from_name', - $from_name_cb = static function ( $from_name ) { - return $this->get_from_name(); + $from_name_cb = static function ( $from_name ) use ( $mailer_from_name ) { + return $mailer_from_name; } ); add_action( 'wp_mail_failed', [ $this, 'catch_error' ] ); -- GitLab