Home of www.RoboHobby.com Java robotics project www.CubesAndCrosses.com
Train your logic skills in geometry
Create and delete one-color crosses
Play for free right in your browser!
Home-made CNC machine
Our new project -
How to make home-made CNC router
PICkit2 - Tutorials, Experiments
PICkit 2 - Small size USB programmer
from Microchip.
How to use it as a demo device for
USB programming in C language

Home of www.RoboHobby.com
Java robotics project

Portable Notebook Table
How to make Portable Notebook Table.
Do it yourself!

Simple Spam Protection
Simple Spam Email Protection -
GWT-based code example


How to make simple spam protection, using GWT-based Java/JavaScript Web interface

Just edit template text and click on 'Do Conversion' button.

Spam emails is really big problem today.
Big and small companies proposed a lot of spam protection tools of any kind.

But is you have your Web page and want to communicate with your readers, how you can give your email
to good peole and not to give it to bad bays, who will send a lot of e-mails to you or will use
your e-mail account as 'Reply To' parameter of spam letters?
In this article we suppose that spammers use special web software robot, which is trying to visit
every possible pages and trying to get e-mails from them.
It is supposed that this kind of software crawlers are looking for word combinations with letter @.
Like 'Send me letter to my e-mail MyEmail@example.com'.

Also it is supposed that crawlers are looking for special HTML tag with mail link:
Mail Link: Send me Email
Tag 'mailto' is very useful HTML tag.
If you click on such a link, your Mail Client software, like Outlook, Thunderbird, etc.
opens and shows you window for sending e-mail.
And you can see your e-mail in the field 'To' and your subject in field 'Subject'.

It is very handy and helps to get more contacts.

But I am afraid that such a link is the first candidate for spammers crawler machines.

There is one way how to protect your e-mail on a web page and use 'mailto' link.
To do this we can place block of HTML code to JavaScript procedure.

Then spammer's crawler will not be able to see your e-mail on the page,
but users still can use 'mailto' link for sending e-mail to you.


Nothing is ideal in this World.
This kind of 'protection' is supposed that crawler is a pretty stupid program and it can not do
interpretation of JavaScript and do any calculations, using it.
Also it is supposed, that user is use JavaScript on his/her browser and do not turned it off.

I created simple Web-based program for conversion of 'mailto' tag to JavaScript code.
Just edit template text and click on 'Do Conversion' button.

Yes, I know, you can think:
"Hey, boy, you are going to protect my e-mail and asking me to put it on your page!
What are you going to do with my e-mail?"
The answer is:

I do not collect your e-mails.

This page use GWT (Google Web Toolkit) technology and it do not do any connections
to my (or any other) web servers.
It is just small client-side application.

Source code of this GWT example:

package com.robohobby.gwtNoSpam.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.TextArea;

 * Entry point classes define <code>onModuleLoad()</code>.
public class GwtEntryNoSpam implements EntryPoint {

    Button conversionButton = new Button("Do Conversion");

    final TextArea inputTextArea = new TextArea();
    final Label infoLabelJs = new Label( "'Past and Copy' JavaScript result:" );
    final Label delimiterLabel = new Label("----------------------------------------------");
    final Label infoLabelHtml = new Label( "Or 'Past and Copy' HTML+JavaScript result:" );
    final Label resultLabelJs = new Label( "" );
    final Label resultLabelHtml = new Label( "" );

    VerticalPanel verticalPanel = new VerticalPanel();

   * This is the entry point method.
  public void onModuleLoad()
      conversionButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {

                String inpStr = inputTextArea.getText();
                String outStr = doConversion( inpStr );
                infoLabelJs.setVisible( true );
                resultLabelJs.setText( outStr );

                delimiterLabel.setVisible( true );
                infoLabelHtml.setVisible( true );
                String htmlStr = toHtml( outStr );
                resultLabelHtml.setText( htmlStr );

      inputTextArea.setText( "<a href='mailto:MyEmail@example.com?subject=Subject Example'>Send me Email</a>" );

      verticalPanel.add( inputTextArea );
      verticalPanel.add( conversionButton );

      infoLabelJs.setVisible( false );
      infoLabelHtml.setVisible( false );
      delimiterLabel.setVisible( false );
      infoLabelJs.setHeight( "30px" );
      verticalPanel.add( infoLabelJs );
      verticalPanel.add( resultLabelJs );

      verticalPanel.add( delimiterLabel );
      infoLabelHtml.setHeight( "30px" );
      verticalPanel.add( infoLabelHtml );
      verticalPanel.add( resultLabelHtml );

      RootPanel gwtPanel = RootPanel.get("gwt_code");
      gwtPanel.add( verticalPanel );


  private String doConversion( String inpStr )
      String charCodes = "";
      String outStr = "";

      if ( inpStr != null || !inpStr.equals("") )
          for ( int i = 0; i < inpStr.length() ; i++ )
              int chrInt = inpStr.charAt(i);
              charCodes += ""+chrInt+",";
          charCodes = charCodes.substring(0, charCodes.length() -1 );

      outStr =
          "<script type='text/javascript' language='javascript'>"+


      return outStr;

  private String toHtml( String inpStr )
      String outStr = "<html>"+
  "<head><title></title><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>"+

      return outStr;



Contact us:

My Skype name is oleg_skp
Start Skype text chatStart Skype text chat
View Skype profileView Skype profile
Start Skype voice callStart Skype voice call
Add me to your Skype contact listAdd to Skype contact list
Leave voicemail using SkypeLeave voicemail using Skype
Send a file using SkypeSend a file using Skype
Note: To use these links
the Skype program should
be installed on your computer.
You can load it for free from
their official site:
Contact via Skypewww.Skype.com