diff options
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; } |