From a5cdf9362fe70eb092baac0fb14983fcb8cb9608 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 22 May 2018 08:28:56 -0400 Subject: [PATCH] Update the wp_mail calls for setting from name. Using the wordpress hook to set the from header name. Also found a typo when using reg_org_name. (correcting...) --- classes/regCartSupport.php | 5 +++-- models/admin/registrations/sendNotifications.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index 7b3e3a5..a77d150 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -1287,12 +1287,13 @@ class GlmRegCartSupport */ public function sendHtmlEmail( $to, $subject, $htmlMessage ) { - + // Set the From name using this wordpress hook. + add_filter( 'wp_mail_from_name', function ($name) { return $this->config['settings']['reg_org_name']; }); // Send confirmation email, set the content type to allow html by using this filter add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) ); $message = $htmlMessage; - $header[] = 'From:' . $this->config['settings']['reg_org_namel'].' <'.$this->config['settings']['reg_org_from_email'].'>'; + $header[] = 'From:' . $this->config['settings']['reg_org_name'].' <'.$this->config['settings']['reg_org_from_email'].'>'; $header[] = 'Reply-To:' . $this->config['settings']['reg_org_from_email']; wp_mail( $to, $subject, $message, $header ); diff --git a/models/admin/registrations/sendNotifications.php b/models/admin/registrations/sendNotifications.php index 4b13642..7907b25 100644 --- a/models/admin/registrations/sendNotifications.php +++ b/models/admin/registrations/sendNotifications.php @@ -272,6 +272,8 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio public function sendHtmlEmail($from, $to, $subject, $htmlMessage) { + // Set the From name using this wordpress hook. + add_filter( 'wp_mail_from_name', function ($name) { return $this->config['settings']['reg_org_name']; }); // Send confirmation email, set the content type to allow html by using this filter add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) ); -- 2.17.1