Avoid Spam Emails by using JavaScript

Related Articles

Ever suddenly received emails asking you if you would like to "enlarge your manhood" and "tips on pleasing women"?

Before you accuse your girlfriend or wife of anything consider this: Even if you're very careful about which website you give your email address to your own website may be at risk of being crawled by a spambot (a spider looking for email addresses). If you advertise your email address on your website one of these spambots can pick it up and add it to a spam email list.

What can you do to protect it?

Use a script that disguises the address but displays it perfectly on-screen. Place the following on your web-pages wherever an email address is listed:

<SCRIPT TYPE="text/javascript"> <!-- emailE=('emailaddress@' + 'yourdomain.com') document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>') //--> </SCRIPT>

replace "emailaddress" with your own (typically "info") and replace "yourdomain.com" with your domain name.

Test it and you'll see the address appear properly.

TIP: Never use the "unsubscribe" option on any of these spam emails - it just confirms your email address is a valid one!

Publication Date: Friday 11th July, 2003
Author: Dan Broughton View profile

Related Articles