Email harvesting measures
Naar navigatie springen
Naar zoeken springen
How to prevent bots from harvesting email addresses from a site?
Encode or obfuscate
- Use JavaScript to display the email address dynamically, as bots often don't execute JavaScript
- Encode the email address using HTML entities (e.g.,
@
for@
and.
for.
) - Encode the email address through CSS or some base64 format.
Example: The script assembles the email address. the part displays the email address.
<script> document.addEventListener("DOMContentLoaded", function() { var user = "example"; var domain = "domain.com"; var email = user + "@" + domain; document.getElementById("email").innerHTML = '<a href="mailto:' + email + '">' + email + '</a>'; }); </script> <span id="email"></span>
Use anti-spam plugin
- Install a plugin like Email Address Encoder to automatically obfuscate email addresses on your site
- Use plugins like WP Spamshield or similar, which provide additional anti-spam protections
Use a contact form
Replace the email address with a contact form like WPForms, Contact Form 7, or Gravity Forms
Display email address in an image
- Create an image of the email address and display the image in the footer
- Note: This can inconvenience users who need to type it manually.