Stop (Most) Spam from Your Website Email Link

Every day we all drown in spam email. Even the best spam filters only catch some of it - it forces us to reach for the delete button all day long.

Reducing spam on your personal email account can be achieved easily by keeping your address to yourself and only giving it out to trusted people and services. But what about your business email? Surely you want to give that out to attract as much business as you can. Then there's your website. Most companies want to have their email address to be easily found on their website!

However, having a clickable email link on your website is a double-edged sword. On the one hand, you want it there to make sure your customers can click a link and email you directly. This avoids copy / pasting your email address into an email client. On the other hand, having you email address on a web page is like advertising your email address for spammers to grab and use. They can usually find and harvest you email find it this way automatically, using bots.

So, what do you do?

One way to make it more difficult for bots to harvest your email address from your website is to encode your email address using something called 'HTML entities'. When you encode the address this way, bots see it as random characters, not as an email address, and so pass it by. However, a human visitor's web browser will automatically decode the address and present it correctly. Oh, and if it's in a clickable link, that will work too!

An example

Here's an example of a clickable email link that you might add to your website:

Notice the email address appears twice, firstly inside the quote marks that forms the 'href' attribute. This tells the email program which email address to send the message to when the user clicks the link. The second appearance of your email address is the one that is shown on the webpage when viewed in a browser. This type of link is easy for bots to find, and they can grab your email automatically. You just opened the door to a bunch more spam! So, let's encode your email address and make it that little bit harder for them.

When encoding the address, it's really important to encode both appearances of your email address in the link, as a bot will read the page code and not the visual representation a human visitor will see. Therefore, if either part of the link has your (unencoded) email address, the bot will get it.

A fully encoded version of the same link would look like this:

Looks like gobbledegook, right? However, a web browser will decode the characters and present it as a usable and readable address.

Obviously, you'll need to use an encoded version of your own email address.

Other methods

There's another method of making your email address more difficult for bots to find and that's by only adding it to the page after the page is loaded using a script. The most common way to do that is using Javascript, a programming language that eall web browsers understand.

The implementation of this method is a little more complex, but, using the link above as an example, we could use this code instead:

Note that, even in the script, the email address is still encoded. You can generate your own version of this script using your own email address here:

Installing the encoded link

If you're unsure how to add these links to your website, then it's probably best to speak to your web developer. While not a complex task, it's pretty easy to add them incorrectly, resulting in an email link that doesn't work or a messed-up web page! It's usually a very quick job for a competent developer.

If you don't have a developer, then please feel free to get in touch and we can certainly help you.

A final note

It's essentially impossible to stop spam completely. It's an ever-changing challenge, with spammers finding new ways to get around security all the time. However, reducing spam so it takes up less of your time (and reduces spam frustration) is certainly a worthwhile thing to work towards.

Have a question?

Get In Touch

Like this article? Share it here...

Get our newsletter for hints, tips & more!