WordPress.org

Make WordPress Core

Ticket #18926: pluggable.php.4.diff

File pluggable.php.4.diff, 705 bytes (added by soulseekah, 10 years ago)

action hook, WP_Error contains additional data, WP_DEBUG

  • wp-includes/pluggable.php

     
    432432        // Send!
    433433        try {
    434434                $phpmailer->Send();
    435         } catch ( phpmailerException $e ) {
     435        } catch ( phpmailerException $e ) {             
     436                if ( WP_DEBUG )
     437                        error_log( sprintf('Cannot send mail. Recipient: %s; Subject: %s -- Error: %s', $to, $subject, $e->getCode(), $e->getMessage() ) );
     438               
     439                $mail_error_data = compact( $to, $subject, $message, $headers, $attachments );
     440                do_action( 'wp_mail_fail', new WP_Error( $e->getCode(), $e->getMessage(), $mail_error_data ) );
     441               
    436442                return false;
    437443        }
    438444