— Check your log files for any errors if you have one.
else
— Create a file say ‘wp-mail-log.txt’ inside your theme folder for temporary period and paste these below code inside theme’s functions.php file to log email issues/status of email fired etc into the log file created. Then you can troubleshoot easily. It will write to the log file each time a email has been fired !!
add_filter( 'wp_mail', 'log_wp_mail', 1 );
add_filter( 'phpmailer_init', 'log_wp_mail', 1 );
function log_wp_mail( $args ) {
try {
$log_message = "\n----------MARK-------------\n" . var_export(
array(
'date' => date( 'r' ),
'args' => $args
), true
);
// Now write the log message somewhere, for example:
$fp = fopen( dirname( __FILE__ ) . '/wp-mail-log.txt', 'a+' );
fwrite( $fp, $log_message );
fclose( $fp );
} catch ( Exception $e ) {
}
return $args;
}