Providing a valid email address is a mandatory step in the installation WordPress. On the email address of the admin user I come password reset messages, site health and messages then when visitors leave comments. For many reasons, however, you want to know how to disable the sending of email messages in WordPress. The main reason being spam messages or, even worse, the vulnerability of a plugin that exploits the function wp_mail()
and sends spam messages to tens of thousands of addresses.
Most spam messages from WordPress are sent via PHPMailer when a form is vulnerable or when a plugin allows third-party PHP scripts to use wp_mail()
.
If you have a blog or a website on WordPress and it is not necessary for the system to send email messages to the administrator or users, then the best solution is to disable the email function of WordPress.
Before following the steps in the tutorial below, remember that this method will completely disable your email system WordPress. Email messages will no longer be sent to reset the password, messages when the site encounters functionality problems or when users comment on the blog. If you use modules like Contact Form, set them not to send email messages via PHPMailer.
- How to reset the user password Administrator WordPress, without access to email or database - Reset WordPress Administrator Password
- How to clean huge wp_options in SQL - Transients, wpseo_sitemap _cache_validator
- Fix WordPress “Briefly unavailable for scheduled maintenance. Check back in a minute. ”
- How to uncheck default “Ship to different address” from the Woocommerce Checkout page
How to disable the sending of email messages in WordPress
This method does not require the installation of a plugin. All you have to do is edit the functions.php file of the active blog theme and add the following lines of code:
add_filter('pre_wp_mail', 'sth_disable_emails');
function sth_disable_emails() {
return false;
}
Save the change. That's all.