Avoiding spam from your web page - disguising your email address

If you have a web site, then a 'mailto' link is a very convenient for anybody browsing to click on, and then use their usual e-mail software to compose and send you a message. However, it is also convenient for spammers. Therefore, to prevent it attracting spam, people often do one of

  • set up a mail form, (although that solution may still attract form spam)
  • remove the mailto link and show their email address as an image (most likely to fool spammers)
  • code the address as Javascript (which usually retains the mailto ability).

One very simple form of 'obfuscating' an address is to just show it with the '@' sign replaced with the word 'at', as in "example_name at gn dot apc dot org".

Also remember that having reports available for download, whether in PDF, MS Word, or other format will expose any e-mail addresses they contain - even if the spambot can't read PDF files itself, a search engine is likely to make available an HTML version. You might want to consider uploading a different version of the document from the print version, with e-mail addresses obscured or altered.

Disguising an address as an image

e-mail address as jpege-mail address as jpegYou can use any graphics program like Windows Paint or Mac Paint or GIMP to add text to a blank background which that you can save as a .PNG or .GIF image to be embedded on your contact page. (You can even put it on a pictorial background and save as a .JPG like this, but there this probably isn't significant additional help against spam.) Bear in mind that people with a visual impairment will not be able to use this.

Disguising an address using Javascript

Here's another possible way of disguising a mailto link with Javascript instead of an image that may well discourage most spammers. It should be added to the code of the page where you want the email address to appear. This example that uses the decimal numbers for certain characters in the email address to make it harder for automated programs (97,1127,99,46,111 is 'apc.o').

Add this to the source of the page you want

You need Javascript to be able to see contact details.


You need Javascript to be able to see contact details.

As implied, one drawback of this is that a few people have Javascript turned off. It is possible to combine a full mailto link available to JS-enabled browsers, with a human-readable approximation when JS is turned off: see http://www.spamspan.com/ for a script to do this.