EMail Spam Protection
You probably know this problem when creating a website: You put your
email address to one of the pages, arrange everything neatly, and KABOOM
- suddenly, your email address gets spammed and you receive heaps of
spam every day, trendline growing.
This happens due to some people who run computer programs, which crawl
the web on the search for email addresses. Once such an address is found
on a website, it is added to a database and abused as a target for spam.
There are basically two effective ways to prevent this.
Method 1 - Disguise your email address by obvious modifications
This one is quite simple to use. You put some extra words into your
email address, which are obvious for a human being to see, but
impossible to spot for a stupid machine. E.g. if your email address
is yourname@company.com, then you can put yournameA-ANTISPAM-A@company.com
to your website. You can do this along with a short note telling that
the A-ANTISPAM-A needs to be removed in order to send you an email.
The result will be that any spamrobot will send it's spam to an address
which doesn't exist, while real human beings will know better.
I use this method of spam protection in the
contact section of this website.
But still, some people don't like it. Although this is a simple, yet
effective way to counter spam, some people don't like it, because it
looks ugly and you can never know - maybe there's still someone who
is just not enough used to computers to understand what you mean and
he or she will send his emails to the wrong address into nowhere.
Especially for company websites, this is not an appealing approach.
Thus, there's another way:
Method 2 - Use JavaScript to hide your email address
Those programs which harvest email addresses from the internet only use
the very minimum of rudimentary technology. That means, they don't know
what to do with JavaScript and just ignore it. Thus, if you use JavaScript
to write the email address onto your webpage, the address remains hidden
from malicious programs but is shown to users in the usual way. This works
as follows:
Usually, you put your email address into an HTML-tag like this:
<a href="mailto:yourname@company.com>
yourname@company.com</a>
|
Now, we don't write this tag directly into the page. Instead, we create
some JavaScript code which will do this for us:
<script language="JavaScript"><!--
var p1 = "yourname";
var p2 = "company.com";
var result = p1 + '@' + p2;
document.write('<a href=\"mailto:' + result + '\">' + result + '</a>');
--></script>
|
Or, shorter but with the same effect:
<script language="JavaScript"><!--
var r = "yourname" + '@' + "company.com";
document.write('<a href=\"mailto:' + r + '\">' + r + '</a>');
--></script>
|
With this method, users won't even recognize that you protect your email
address. They can click the link to your address and email you as usual.
Only those of your visitors can have trouble who are either paranoid and
have switched off JavaScript in their browsers or those with old browsers
which don't evaluate JavaScript at all. But this is a rather evanescent
number of users.