How to Stop WordPress Sending Emails (Without a Plugin)

The following WordPress PHP will stop your WordPress site from sending emails.

This may be helpful if you’re working on in a test environment and do not want emails to be send.

Just add this code to your theme’s functions.php file:

add_filter('pre_wp_mail', 'stop_emails');
function stop_emails() {
    return false;