Encode your email address
There are several methods to protect or encode your email from the web crawlers used by spammers to harvest email addresses from web pages. These crawlers usually read the source code that makes a html page and will search for the html link code “mailto:“ which identifies the text contained in the link as an email address.
- Replace the @ symbol with the word “at”
- Replace the ascii characters with decimal equivelents
- Use an image to display your email address
- Use a form to send email
- Use javascript to encode your email address
- Use php to encode the address
- Use Microsoft Active Server pages (ASP) to encode the address
- 3rd Party Hosted Applications
Replace the @ symbol with the word “at”
This is probably the lease effective method because the spammers can program their crawlers to account for this, but it's better than nothing
gregwapling@hotmail.com > gregwapling at hotmail.com
Replace the ascii characters with decimal equivelents
This technique is not by any means a foolproof solution - high end software such as that used by Google's™ search engine can still sniff out your email address regardless. But this technique will still certainly go a long way towards minimizing your exposure to less capable automated email harvesters.
For example:
On the visible web page:
"For more information, send email to yourname@domain.com."
In the source code for the web page, the above should look like this:
"For more information, send email to <A HREF="mailto: |
Use an image to display your email address
This method is very effective at stopping crawlers from reading your email address, but is very inconvienent for visitors to your site as they have to read the image and type in your address. Obviously there is potential them to make a mistake when doing this.
Form
A form is a very secure method of providing your email address without letting the web crawlers read it. But it depends on how your visitors have there email client configured as to wether or not when the click the link it will automatically create a new email.
Javascript
Javascript can either be embedded in the page (secure)or call a seperate javascript file (even more secure)
- Encode email method 1 (cut up the email address and then reassemble it)
- Encode email method 2 (cut up the email address and then reassemble it)
- Encode email method 3 (calls a seperate javascript file with contains you email address.)
- Encode email method 4 (cut up the email address and then reassemble it using the sendMailTo() function)
- Encode email method 5 (cut up the email address and then reassemble it using the sendMailTo() function) enhanced version - 2 options
Method 1
To encode this address -
Copy and paste this html code into your page;
<SCRIPT LANGUAGE="JavaScript"> |
Method 2
To encode this address -
Copy and paste this html code into your page;
<script> |
Method 3
Using a call to javascript file.
- You will need to download this email.js file.
- Edit the email.js file to add your email address.
- Then add the following html code to web page.
- Lastly post both files to your virtual server.
Method 4
This method has 2 parts. First, there's a JavaScript function which you should include in the head of your HTML document, or in an external JS file. The link's HREF action needs to call this function. Here's the code:
<script language="JavaScript"> <!-- |
You can simply cut this out of this page and paste it into your document. Once it's there, set up your mail link to call this function:
<a href="javascript:sendMailTo('gregwapling','hotmail','com')">gregwapling@hotmail.com</a> |
Method 5
If you need to pack some more info into your mail, you can use these extended forms of the sendMailTo() function:Option 1
Option 2
Method 5 - option 1
function sendAnnotatedMailTo(name, company, domain, subject, body) { |
Then, copy one of these examples to call the appropriate function:
<a href="javascript:sendAnnotatedMailTo('gregwapling','hotmail','com','the subject','body text')">gregwapling@hotmail.com</a> |
Method 5 - option 2
function sendFullMailTo(name, company, domain, subject, cc, bcc, body) { |
Then, copy one of these examples to call the appropriate function:
<a href="javascript:sendFullMailTo('gregwapling','hotmail','com','the subject','cc@mail.com','bcc@mail.com','body text')">gregwapling@hotmail.com</a> |
These techniques eliminates the mailto: URL that most spambots look for. Unfortunately, the latest generation of spambots seems to use regular expression matching to look for text combining @ with .com, .org, etc. These spambots will find and eat up the plain-text address listed above, so we need a second technique to obfuscate it.
Use php to encode the address
<?php //begin parsing //create the js address //build the js events //return |
This is called using:
<% =mailMe("Webmaster@example.com?subject=hey out |
Now you can do it all on the server. Add a <script> tag on the client that references your decoding javascript file with the mailMe() function in it and you're golden.
Use ASP to encode the address
<% |
This is called using:
<% =MailMe("Webmaster@example.com","Contact Me!","Send me email") %> |
...where "Webmaster@example.com" is the target email address, "Contact Me!" is the display text (DO NOT USE THE EMAIL ADDRESS HERE!!!) and "Send me email" is the title attribute (what is displayed on float over or read to voice interface prompts and stuff). That function results in the complete HTML anchor tag, resulting in (breaks added for readability):
<a href="/contact/" |
3rd Party Hosted Applications
- Hivelogic Enkoder form - recommended