diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-06-01 12:02:59 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-06-01 12:02:59 +0000 |
commit | af8dd075caa001a715e27360be37fbeb29e80ca7 (patch) | |
tree | 306bff4b589820bce83a3848b4dc68c6e73be2ae /Postman/PostmanWpMail.php | |
parent | 0be305734dfb56231d592fa7b134dc66e5058cb3 (diff) | |
download | Post-SMTP-af8dd075caa001a715e27360be37fbeb29e80ca7.zip |
Proxy the phpmailer hook for better compability and verify and adding extra hooks
Diffstat (limited to 'Postman/PostmanWpMail.php')
-rw-r--r-- | Postman/PostmanWpMail.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Postman/PostmanWpMail.php b/Postman/PostmanWpMail.php index b39c596..eadfe60 100644 --- a/Postman/PostmanWpMail.php +++ b/Postman/PostmanWpMail.php @@ -166,6 +166,7 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { // apply the WordPress filters // may impact the from address, from email, charset and content-type $message->applyFilters(); + do_action_ref_array( 'phpmailer_init', array( &$message ) ); // create the body parts (if they are both missing) if ( $message->isBodyPartsEmpty() ) { @@ -234,6 +235,17 @@ if ( ! class_exists( 'PostmanWpMail' ) ) { PostmanEmailLogService::getInstance()->writeFailureLog( $log, $message, $engine->getTranscript(), $transport, $e->getMessage() ); } + $mail_error_data = array( + 'to' => $message->getToRecipients(), + 'subject' => $message->getSubject(), + 'message' => $message->getBody(), + 'headers' => $message->getHeaders(), + 'attachments' => $message->getAttachments() + ); + $mail_error_data['phpmailer_exception_code'] = $e->getCode(); + + do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) ); + // return failure return false; } |