Sometimes you might want to prevent WordPress from sending emails. This can be handy when working on a staging environment and want to make sure no emails are sent from the site.
To stop WordPress from sending emails altogether, simply add this to your theme’s functions.php file:
add_filter('pre_wp_mail', 'templ_disable_emails');
function templ_disable_emails() {
return false;
}