diff options
Diffstat (limited to 'Postman')
-rw-r--r-- | Postman/Phpmailer/PostsmtpMailer.php | 13 | ||||
-rw-r--r-- | Postman/Postman.php | 3 | ||||
-rw-r--r-- | Postman/PostmanWpMail.php | 9 |
3 files changed, 13 insertions, 12 deletions
diff --git a/Postman/Phpmailer/PostsmtpMailer.php b/Postman/Phpmailer/PostsmtpMailer.php index 82527d2..f3e0479 100644 --- a/Postman/Phpmailer/PostsmtpMailer.php +++ b/Postman/Phpmailer/PostsmtpMailer.php @@ -33,13 +33,11 @@ class PostsmtpMailer extends PHPMailer { $senderEmail = $this->options->getMessageSenderEmail(); $senderName = $this->options->getMessageSenderName(); - $this->addCustomHeader('X-Mailer', 'PostSMTP/' . POST_SMTP_VER ); - // create a PostmanMessage instance $message = $postmanWpMail->createNewMessage(); $message->setFrom( $senderEmail, $senderName ); - $message->addHeaders( $this->getCustomHeaders() ); + $message->addHeaders( $this->getHeaders() ); $message->setBodyTextPart( $this->AltBody ); $message->setBodyHtmlPart( $this->Body ); $message->setBody( $this->Body ); @@ -75,6 +73,15 @@ class PostsmtpMailer extends PHPMailer { } + private function getHeaders() { + $headers = array(); + foreach ( $this->getCustomHeaders() as $header ) { + $headers[] = "{$header[0]}: {$header[1]}"; + } + + return $headers; + } + public function postman_wp_mail_result() { $result = [ 'time' => '', diff --git a/Postman/Postman.php b/Postman/Postman.php index 2956d44..c3b0177 100644 --- a/Postman/Postman.php +++ b/Postman/Postman.php @@ -97,8 +97,9 @@ class Postman { $this->logger->trace( 'SMTP Mailer: ' . PostmanOptions::getInstance()->getSmtpMailer() ); + $mailer = PostmanOptions::getInstance()->getSmtpMailer(); if ( PostmanOptions::getInstance()->getTransportType() == 'smtp' && - PostmanOptions::getInstance()->getSmtpMailer() !== 'phpmailer') { + $mailer && $mailer !== 'phpmailer') { // bind to wp_mail - this has to happen before the "init" action // this design allows other plugins to register a Postman transport and call bind() diff --git a/Postman/PostmanWpMail.php b/Postman/PostmanWpMail.php index 3d1f8f5..66b3279 100644 --- a/Postman/PostmanWpMail.php +++ b/Postman/PostmanWpMail.php @@ -42,10 +42,6 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { // initialize for sending $this->init(); - if ( ! is_array( $headers ) ) { - $headers = explode( "\n", str_replace( "\r\n", "\n", $headers ) ); - } - // build the message $postmanMessage = $this->processWpMailCall( $to, $subject, $message, $headers, $attachments ); @@ -65,11 +61,8 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { * @return PostmanMessage */ private function apply_default_headers( $message ) { - $headers = $message->getHeaders(); $headers[] = 'Message-ID: ' . $this->createMessageId(); $message->addHeaders($headers); - - return $message; } /** @@ -182,7 +175,7 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { */ public function sendMessage( PostmanMessage $message, PostmanEmailLog $log ) { - $message = $this->apply_default_headers( $message ); + $this->apply_default_headers( $message ); // get the Options and AuthToken $options = PostmanOptions::getInstance(); |