From 8c9462e6ab86a80ad79ea478601a38c76915548e Mon Sep 17 00:00:00 2001 From: yehudah Date: Mon, 20 Jan 2020 17:45:49 +0000 Subject: html content type bug --- Postman/Phpmailer/PostsmtpMailer.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Postman/Phpmailer/PostsmtpMailer.php b/Postman/Phpmailer/PostsmtpMailer.php index 838cdc5..c86a0a0 100644 --- a/Postman/Phpmailer/PostsmtpMailer.php +++ b/Postman/Phpmailer/PostsmtpMailer.php @@ -15,6 +15,8 @@ add_action('plugins_loaded', function() { class PostsmtpMailer extends PHPMailer { + private $mail_args = array(); + private $options; private $error; @@ -38,11 +40,22 @@ class PostsmtpMailer extends PHPMailer { } public function hooks() { + add_filter( 'wp_mail', array( $this, 'get_mail_args' ) ); if ( $this->options->getTransportType() == 'smtp' ) { add_action( 'phpmailer_init', array( $this, 'phpmailer_smtp_init' ), 999 ); } } + public function get_mail_args( $atts ) { + $this->mail_args[] = $atts['to']; + $this->mail_args[] = $atts['subject']; + $this->mail_args[] = $atts['message']; + $this->mail_args[] = $atts['headers']; + $this->mail_args[] = $atts['attachments']; + + return $atts; + } + /** * @param PHPMailer $mail */ @@ -76,9 +89,7 @@ class PostsmtpMailer extends PHPMailer { $postmanWpMail = new PostmanWpMail(); $postmanWpMail->init(); - $backtrace = debug_backtrace(); - - list($to, $subject, $body, $headers, $attachments) = array_pad( $backtrace[1]['args'], 5, null ); + list($to, $subject, $body, $headers, $attachments) = array_pad( $this->mail_args, 5, null ); // build the message $postmanMessage = $postmanWpMail->processWpMailCall( $to, $subject, $body, $headers, $attachments ); -- cgit v1.2.3