Global Header
, , ,
2 Mins Read

How to Hide Email Addresses from Bots and Spammers

Home Blog Security How to Hide Email Addresses from Bots and Spammers
SQL Injection

When dealing with an increase in spam emails, bots may have harvested your email address from your website. Fortunately, there are ways to protect your email from spammers while making it accessible to legitimate users. This guide will show you a simple JavaScript method to hide email addresses from bots and spammers, ensuring your contact information stays secure.



Steps to Hide Email Addresses from Bots and Spammers

Using a small piece of JavaScript can:

  • Prevent email harvesters from detecting your email address
  • Protect your email from spammers
  • Allow users to contact you

Here’s a step-by-step method to hide your email from spambots:

1. Insert a small JavaScript snippet into your webpage’s HTML where you want your email displayed.JavaScript to Hide Email (example):

<SCRIPT TYPE="text/javascript"> emailE = 'example.com' emailE = ('yourname' + '@' + emailE) document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>') </script>

2. To tailor this JavaScript code to your website, modify the email address section to reflect your website’s contact email. Here’s how you can adjust it:

  • Replace ‘example.com’ with your email domain (for example, bluehost.com)
  • Replace ‘yourname’ with your email prefix (for example, ‘contact’ if your email is contact@[bluehost].com).
  • Ensure the rest of the script remains the same to maintain the functionality of creating the clickable mailto link.

3. Insert the following link where you want the email address to appear on your webpage:

<a href="javascript:m_sfcon('YOUR-EMAIL-PREFIX-GOES-HERE')">Email Me</a>

This will display the text ‘Email Me’ as a clickable link for users to email you.

4. After adding and customizing the code, test the link on your website to ensure it works correctly. The email address shouldProtect Email from Harvesters but still be accessible to legitimate users who click the link.

Why Should You Protect Email from Bots and Spammers

Email harvesting bots scour the internet, looking for email addresses to send unsolicited emails or spam. By hiding your email address in the way described above, you make it much harder for these bots to find and use your contact information. This reduces the risk of spam and secures email contact information.

Summary

Protecting your email from spammers and bots is vital in this digital world. With this simple JavaScript method to hide email addresses from spammers and bots, you can keep your contact information safe while offering users an easy way to reach you. All this keeps your email safe from those spam messages; otherwise, it may give you an impossible headache by getting too numerous to handle.

  • Khushboo Rathod is a Content Writer at Bluehost with over four years of experience creating SEO-friendly, value-driven content. She believes good writing serves both search engines and readers alike. Outside of work, she is an astrologer and has a deep interest in spirituality and the occult.

Learn more about Bluehost Editorial Guidelines
View All

Write A Comment

Your email address will not be published. Required fields are marked *

Longest running WordPress.org recommended host.

Get Up to 61% off on hosting for WordPress Websites and Stores.