summaryrefslogtreecommitdiff
path: root/Postman/PostmanWpMail.php
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-06-01 12:02:59 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-06-01 12:02:59 +0000
commit1058be7a3e0ea827ed02266b0af9d40e794d041c (patch)
tree306bff4b589820bce83a3848b4dc68c6e73be2ae /Postman/PostmanWpMail.php
parent7ca4428c160996f82aa130e2aeb288dffdb2764f (diff)
downloadPost-SMTP-1058be7a3e0ea827ed02266b0af9d40e794d041c.zip
Proxy the phpmailer hook for better compability and verify and adding extra hooks
git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1885422 b8457f37-d9ea-0310-8a92-e5e31aec5664
Diffstat (limited to 'Postman/PostmanWpMail.php')
-rw-r--r--Postman/PostmanWpMail.php12
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;
}