Javascript Email Protection

Version 0.1
Authour: Evans Anyokwu
Last updated 22/June/2003

This is a very simple but effective way to safe guard your corporate or personal email address from being harvested by spammers. These clever souls use highly sophisticated methods including bots to get email addresses of unsuspecting victims from various sources. This could be forums, usenets, blogs or even on your private or corporate websites. If you list your email directly on your site it can be picked up by bots designed to 'farm' email addresses. What that means for you is SPAM. Nobody likes to have their inbox flooded with SPAM, and using a form can help prevent that.

If like many site owners, you don't want to use forms, the tips shown here are some of the many steps you could take to protecting your email address on public sites. That said, I will start by showing you a series of code samples and how to use them in your application. Finally, a working sample is included for you to download and use as you see fit.

The code:

<!--http://www.onyxtic.com/evans-->
<script type="text/javascript">
function contact(textName,address) {
  document.write('<strong>' + textName + '</strong><br>\n');
  document.write('<a href="mailto:' + address + '@' + 'domain.com">');
  document.write(address + '@' + 'domain.com' + '</a><br>');
}
</script>
As the requirements have been laid out above, its very important that we follow the steps one by one, and test as we go. First, we have to create a very simple application that accepts connect on the port specified, and then proceed to making that server class a multi-threaded class because as the requirements stipulates, it should accepts multiple clients.

<script type='text/javascript'>
    var addr = 'yourEmail';
    var host = 'domain.com';
    var host1 = 'domain.com?subject=Your subject here';
        
    var email = '<a href="mailto:' + addr + '@' + host1 + '">' + addr + '@' + host + '</a>';
    document.write(email);
</script> 

The piece of code shown above implements a Runnable interface bacause it has to be a threaded application.

On the left hand column, I have listed some of the modules and packages that I use daily on my Python development. To learn more about them, click on each to go the website with information on how to download and start developing with them. If you are a Java developer and an Eclipse fan, you might find the PyDev handy as it is a plugin for Eclipse. This allows you to develop all your Python and Jython code on the Eclipse platform complete with syntax highlighting, refactoring, syntax analysis and debugging.

Usage::

<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
  <td width="198" valign="top">
 <script language="javascript">
  </script>
   <p>

<script language="javascript">contact('Advertising','advertising')
</script>
 <br>
 <script language="javascript">contact('Sales Support','sales')
</script>
  <br>
   <script language="javascript">contact('Purchasing Inquiries','purchasing')
</script>
     </p>
    </td>

    <td width="242" valign="top">
    <p>
     <strong><font color="blue">NEW</font> Phone:</strong> <br>
        (+44) 844-562-3475 <br>
        <b>VOIP Call:</b> (877)<br />

       <span style="color:White"><b>Direct Phone:</b> </span>(+44)
       709-239-5748</p>
       <p><strong><font color="red">NEW</font> Fax: </strong>
      <br>
      (+44) 208-825-5245</p>
       <p><strong>Address:</strong><br>
        Evans Development Labs.<br>

        South London<br>
        United Kingdom  
                    </p>
                </td>
            </tr>
        </table>
&nbsp;<br />

Download source code:  Download Icon

User Comments:

Nice, you should check out your old site. Looks very interesting.
Posted by Obama on - Tue Nov 18 18:46:48 UTC 2008

This is nice but there are better ways to hide your emailaddress. One such way is to put your email in a gif or something. Nice tip though!
Posted by Henry Dominik on - Tue Nov 18 14:30:50 UTC 2008

ukygiytuyh
Posted by Evans Anyokwu on - Sat Jul 5 12:12:22 BST 2008

This is done Sunday morning, and hope it works fine I believe it shouldEvans
Posted by Evans Anyokwu on - 2008-06-22 08:30:20

Thanks, I will use it in my next project
Posted by James on - 2008-06-22 15:57:50

This is Tuesday, I would like to see it work please
Posted by Evans Anyokwu on - 2008-06-24 14:25:19

Nice tip, keep it up
Posted by Wilson on - 2008-06-24 15:44:01

See if it works for saturday
Posted by Evans Anyokwu on - 2008-07-05 11:49:38

Don't get me wrong, there are times when I can positively recommend a book or resource based on the area or domain that you are interested in. For example, I'm currently reading the Definitive Guide to SQLite, to write my first database app, you migh
Posted by Elephant on - 0000-00-00 00:00:00

Don't get me wrong, there are times when I can positively recommend a book or resource based on the area or domain that you are interested in. For example, I'm currently reading the Definitive Guide to SQLite, to write my first database app, you might want to pick up wxPython in Action if you're going to start writing wxPython GUIs; or Python & XML if you're doing XML work; etc. The reason for this exception is to help you to narrow your search and effort to a domain-specific area. Apart from that, I will not recommend any book as we all learn differently.

Post question or comment

IDE

Another question that we come across often is which IDE is the best to use. Again, there are no right answers here. If you are on windows and you downloaded your Python installation from Python.org, then you do not need any other IDE as it installs IDLE by default. This is the official IDE that most guys on the mailing list probably use on their Windows environment. Having said that, other 3rd-parties also produce their own IDEs. A typical example is Pythonwin from ActiveStates' ActivePython distribution (which is not open source).

The list of all available IDEs can be found here is you are more interested on learning about the IDEs than the language.

Finally, I have decided to list the books here to help you with your quest for that killer Python book :-) One of those excellent online books is this, it contains all the information that a new Python programmer will find very useful.

But if you have a few quid and you want something you could have on your bookshelf, here are my recommendations:


Find out more about Me.


Tutorials

Java Sockets
J2ME
XML
Fizz Buzz
Web Services
The Secret