diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2020-01-20 17:45:49 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2020-01-20 17:45:49 +0000 |
commit | 8c9462e6ab86a80ad79ea478601a38c76915548e (patch) | |
tree | 68799f45fcef8dceeefab732718701d9780b73a9 | |
parent | 3686a6e1793a2c5af8b7ee4459e20887f08dc720 (diff) | |
download | Post-SMTP-8c9462e6ab86a80ad79ea478601a38c76915548e.zip |
html content type bug
-rw-r--r-- | Postman/Phpmailer/PostsmtpMailer.php | 17 |
1 files 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 ); |