An email address like yourid@yourdomain.com can
be written as yourid@antispam_yourdomain.com. In
this format the user has to neglect the characters
"antispam_" so that he can get a valid email address
to send emails. In this method the user should be
informed of how to use the email address. A short
description should be given to the use on how to
use the email address given in the web page. We
cannot ensure that each and every user will read
the information and use the email address in a proper
format. This method also disallows the spambots
from harvesting the emails from your website. We
cannot expect all the users to be experienced in
finding out this information. Most of them would
like to just click the link to an email address
and send an email. For such user this method will
not be user-friendly.
Encoding mailto link with JavaScript
Another way to prevent spambots from harvesting
emails by finding the mailto link is to use JavaScript
for encoding the mailto link. A sample JavaScript
is given below, which can be used to encode the
mailto link.
<SCRIPT type="text/javascript" language="javascript">
<!-- Begin
id ="yourid";
domain ="yourdomain.com";
document.write('<a href=\"mailto:'+id+'@'+domain+'\">');
document.write(id+'@'+domain+'</a>');
// End -->
</SCRIPT>
By using the above code you can avoid spambots
by harvesting emails. One of the disadvantages of
this type of encoding through JavaScript is that
some of the users might turn off JavaScript in their
browser. The given code above is only one format
of JavaScript. There are many types of JavaScript
to encode the mailto link. If you are not an expert
in writing code to encode in JavaScript, then there
are user-friendly forms available in lots of websites
that can be used to generate the script for you.
Try using these forms and generate the script needed
for your requirements.
URL encode your email address
URL encoding the email address is one another way to prevent spambots from harvesting your email addresses. For example you can use the string "%2E" for ".", in URL encoding. The equivalent for '@' is "%40" in URL encoding. Now-a-days spambots are getting more intelligent to even interpret this type of encoding. This can prevent you in preventing certain types of spambots.
Character entity encoding is a way to encode the
entire email address or parts of the email address
so that the spambots do not recognize that is there
in the <a> tag of the html. For example you
can encode the email address yourid@yourdomain.com
in to something like:
<a href="mailto:your
id@yourdom
ain.com">your
id@yourdom
ain.com
</a>
using character encoding. In this method each and
every character in the email address is encoded
so that spambots cannot find the email address.
When displayed in the web page the above encoding
is interpreted as <a href=”mailto:yourid@yourdomain.com”></a>
by the browser. But the spambots would not recognize
that. You need not be an expert to encode your email
address in this form. You can use tools like Email
encoder available at http://www.proles.net/emailencoder/.