This is just a quick post to share something too many people don’t know: how to protect your email address so that bots can’t harvest it and you won’t start receiving tons of spam.

You see, when you put your email address on your website, it’s very simple to read it, add it to a list and then bombard it with unsolicited email. It’s annoying, but it’s easy to fix in two steps.

Step 1: Convert your address into an image

To do this, visit if you use a web-based service (like Gmail) or if you email  account is in your own domain.

Pick colors for text, background and border, choose a font and click Generate. Then, save the generated image to your computer. When you do, use a file name that nobody would link with email addresses, such as nospam.png.

Finally, upload the image to your website. I will use images/nospam.png as an example.

Alternatively, run any image editor, type your email address in as text, (crop, re-size and make any other modifications until you’re happy with what you get) and save the image.

Step 2: Cloak your email address image

In your contact page code, include the following snippet of JavaScript code, which opens up a new message window on the site visitor’s, to be sent to your email address.

Note that in the code below, I have not used terms like “send”, “email” or “address” and I am breaking various items up (like the parts of the email address or the word “subject”) to make it as difficult as possible for bots to guess what’s going on. It’s not bullet proof, but every counter measure reduces more spam.

Replace “[your email ID]” with your real email ID and “[your email domain]” with your real email domain. Your email address is email-id@email-domain, e.g.

<script type="text/javascript">
function useImage(){
var part1 = "[your real email ID]";
var part2 = "[your real email domain]";
var title = "Website inquiry";
var everything = 'm'+'ailt'+'o:'+part1+'@'+part2+'?s'+'ubject='+title;
win =,'anotherWindow');
if (win && &&!win.closed) win.close();

To use your image, all you have to do now is include the code below:

<a onclick="useImage();" href="#">
 <img src="images/nospam.png" border="0"
  alt="I hate spam" align="absmiddle" />

This will look like a valid email address to a human being, but complete gibberish to an automatic robot.

Final note: bots are getting smarter all the time, so you may choose to do some more editing to your image or use another image generating site to make the image harder to decipher.

That’s it! You’re protected, but your clients can contact you by email.


Leave a Reply

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