WordPress.org

Make WordPress Core

Ticket #18926: 18926.2.diff

File 18926.2.diff, 658 bytes (added by kurtpayne, 4 years ago)

Log mail errors when WP_DEBUG is enabled

  • wp-includes/pluggable.php

    Property changes on: .
    ___________________________________________________________________
    Added: svn:ignore
       + .wp-config.php.swp
    
    
     
    433433        try { 
    434434                $phpmailer->Send(); 
    435435        } catch ( phpmailerException $e ) { 
     436                if ( WP_DEBUG ) 
     437                        error_log( sprintf('Cannot send mail.  Subject: %s -- Error: %s', $subject, $e->getCode(), $e->getMessage() ) ); 
     438                do_action( 'wp_mail_fail', new WP_Error( $e->getCode(), $e->getMessage() ) ); 
    436439                return false; 
    437440        } 
    438441