What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
How to Prevent Spam Emails for Better WordPress Security

How to Prevent Spam Emails for Better WordPress Security

The spam email can be regarded as a huge trouble for many webmasters. Also known as junk mail or unsolicited bulk mail, it is the electronic spam containing the same content sent to a large number of webmasters. If people click on the links involved in the email, they will be directed to a phishing site or a website including malware.

Generally, the spam email is offensive, causing some security issues or potential vulnerabilities to the website, especially for the e-commerce site. Now, you may be wondering how to prevent spam emails effectively. In the following, we have listed some useful methods helping you achieve your goal with ease.

Method One: Email Encrypting

This method is one of the most effective ways to protect your website away from spam email. By encrypting your email, no spammers can scan your WordPress site for getting the email address, reducing the possibilities of spam email to the largest extent.

To do this, you can make use of some powerful and user-friendly WordPress plugin. Here, we highly recommend CryptX. It is very easy to use, handle, and configure. With it, your email address can be automatically scrambled so that spammers can’t harvest your mail.

In the very beginning, you need to download, install, and activate this tool. You can do this from WordPress.org, but we suggest you doing this from your WordPress admin panel. You only need to go to WordPress dashboard < Plugin < Add New. Then, you can enter CryptX into the search box and click the Search Plugin button. Next, you can see a list of related plugins in the following screen. Find your target and click on the Install button. After activating it, you can use it immediately. activate plugin

Now, you can go to the setting tab to find this plugin for configuration. Under the Presentation tab, you can choose custom characters with the “at” sign and the “dot” sign. Also, you are able to scramble your email address with AntiSpamBot or simply change the mail to an image with the PNG format.

presentation tab

Now, you can go to the General Setting to apply CryptX to anywhere you want, including content, custom fields, excerpt, comments, and widgets. We suggest you choosing all of these options.

In addition, you can also choose the type of decryption between the utilization of JavaScript and Unicode. After selecting the type, don’t forget to check the box before “add mail to all unlinked email addresses”.

In fact, you can also encrypt your email address by adding some lines of code into your template directly. We have already come out the coding stuff. You only need to copy and paste in into the function.php file of your WordPress theme, along with the parameter of your own website values.

cryptx coding

Method Two: WordPress AntiSpamBot Function

According to WordPress Codex, WordPress has a default anti-spam function that is called AntiSpamBot. This in-built feature can prevent spam bots by converting the characters of your email address to the HTML entities. To enable AntiSpamBot, all you need to do is to paste the following lines of code at anywhere within your WordPress theme.

echo antispambot( '[email protected]' );

You can also use this function in your widget with a new text widget. To do this, simply go to the Appearance tab of your WordPress admin panel, and click the Widgets option. Then, you can drag and drop the Text Bar into anywhere you want within the sidebar to create a new widget. Then, add the following coding into the widget content.

add_filter( 'widget_text', 'shortcode_unautop' );
add_filter( 'widget_text', 'do_shortcode' );


Susan Rose is a freelance writer who has a deep knowledge about WordPress. She loves everything related to website building since the freshman year at Christopher Newport University, and loves to share her experience with people all over all the world. In the daily life, Susan loves detective novels as it can train her logical thinking and creativity.