This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example wp_mail() override that you can place in your site's wp-config.php. | |
// Read the corresponding post https://www.itthinx.com/2021/09/06/wordpress-mail-debugging/ | |
define( 'WP_DEBUG', true ); | |
define( 'WP_DEBUG_LOG', true ); | |
define( 'WP_DEBUG_DISPLAY', false ); | |
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { | |
$output = sprintf( | |
"\n\n" . | |
"---------- Caught email via wp_mail() override in wp-config.php ---------- \n\n" . | |
"To: %s\n\n" . | |
"Subject: %s\n\n" . | |
"Message: %s\n\n" . | |
"Headers: %s\n\n" . | |
"Attachments: %s\n\n" . | |
"-------------------------------------------------------------------------- \n\n" . | |
"\n\n", | |
$to, | |
$subject, | |
$message, | |
json_encode( $headers ), | |
json_encode( $attachments ) | |
); | |
error_log( $output ); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment