Email ids shown in webpages like hello@domain.com or hello [at] domail.com were easily crackable using simple regex.
Spam programmers were always smarter than programmers. Aren't they ?
The below shown 3 options is an attempt to avoid spammers scripts to read your email id.
Option 1:
Clicking the word 'My email id' will open default email program with the to email id and subject filled in.
Copy and paste the below script inside head tag
<SCRIPT type="text/javascript"> function email(user, domain, ext, subject) { location.href = 'mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject; } </SCRIPT>
<a href="javascript:email('balajidl','javaranch','com','hello there..');">My email id</a>
Option 2:
Use the below script to write your email id directly on webpage. The advantage is its visible to human eyes but hard to read by spammers scripts.
<script type="text/javascript"> //<![CDATA[ document.write("<a href='mailto:balajidl"); document.write("@javaranch.com'>"); document.write("balajidl"); document.write("@"); document.write("javaranch."); document.write("com<\/a>"); //]]> </script>
Option 3: Start thinking whether you want to display your emailid or not. ;-)
TrackBacks[0]
Comments[6]
Posted by balajidl on 31 January 2006 10:47:24 CET
Reply |
Permalink
Re: Simple ways to protect your email id from spam
Hi Balaji,
I tried option one. I did exactly as it has been said here in my blogger. I am getting the link, but when I click the link its NOT opening the outlook express.
With option two it's not even showing up any link.
I appreciate your help here.
Comment from Vishnu on 01 February 2006 10:22:31 CET
Hi Vishnu,
Few things you can test further
1. Does your browser opens outlook express if you click email id's from this particular blog page or even other websites ?
2.For option1, try to alert the input variable before calling location.href and tell whether it is meaningfull for javascript. Something like alert('mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject);
3.For option 2: its a simple code that should work in standards browsers, unless javascript is disabled.
4.if nothing works, please drop a post at <a target="_blank" href="">html forum of javaranch, folks there will certainly help you.
Let me know how it goes ??
Thank you. - Balaji
Few things you can test further
1. Does your browser opens outlook express if you click email id's from this particular blog page or even other websites ?
2.For option1, try to alert the input variable before calling location.href and tell whether it is meaningfull for javascript. Something like alert('mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject);
3.For option 2: its a simple code that should work in standards browsers, unless javascript is disabled.
4.if nothing works, please drop a post at <a target="_blank" href="">html forum of javaranch, folks there will certainly help you.
Let me know how it goes ??
Thank you. - Balaji
Comment from balaji on 01 February 2006 14:05:21 CET
Hi Balaji,
Thanks for replying.
1. Does your browser opens outlook express if you click email id's from this particular blog page or even other websites ?
No problems with the browser. I am using the latest version of Firefox Browser. when I click 'My email id'(from your blog) it opens outlook express with your javarnch ID and with Subject "hello there.."
I tried the following code in my blog and when I click the link it opens the outlook express.
a href="mailto:vp17in@gmail.com"> Email Me /a
2. For option1, try to alert the input variable before calling location.href and tell whether it is meaningfull for javascript. Something like alert('mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject);
Is it some thing like the below code. This too isn't working. I am using blogspot(blogger).
<script language="text/javascript">
function email(user, domain, ext, subject) {
alert('mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject);
location.href = 'mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject;
}
</script>
3. For option 2: its a simple code that should work in standards browsers, unless javascript is disabled.
Yes of course it is working from your blog, but when I try to do it in my blog it isn't.
Thank you. - Vishnu
Thanks for replying.
1. Does your browser opens outlook express if you click email id's from this particular blog page or even other websites ?
No problems with the browser. I am using the latest version of Firefox Browser. when I click 'My email id'(from your blog) it opens outlook express with your javarnch ID and with Subject "hello there.."
I tried the following code in my blog and when I click the link it opens the outlook express.
a href="mailto:vp17in@gmail.com"> Email Me /a
2. For option1, try to alert the input variable before calling location.href and tell whether it is meaningfull for javascript. Something like alert('mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject);
Is it some thing like the below code. This too isn't working. I am using blogspot(blogger).
<script language="text/javascript">
function email(user, domain, ext, subject) {
alert('mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject);
location.href = 'mailto:' + user + '@' + domain + '.' + ext + '?subject=' + subject;
}
</script>
3. For option 2: its a simple code that should work in standards browsers, unless javascript is disabled.
Yes of course it is working from your blog, but when I try to do it in my blog it isn't.
Thank you. - Vishnu
Comment from vishnu on 02 February 2006 11:06:06 CET
Hi Vishnu,
Guess blogspot is not allowing to execute script from blog entries.
The simple hack could be to copy and paste the script tag between the head tag of your template.
Go to settings page of your blog, then click Template. You will get an editable textbox, add the option script between the head tags. Save it and republish your blog.
Now simply add the line <a href="javascript:email..">.. part inside your blog. This will call the email function.
You can see a working sample at http://balajidl.blogspot.com/ under the topic file extensoin check, click My email id.
Regards
Balaji
Guess blogspot is not allowing to execute script from blog entries.
The simple hack could be to copy and paste the script tag between the head tag of your template.
Go to settings page of your blog, then click Template. You will get an editable textbox, add the option script between the head tags. Save it and republish your blog.
Now simply add the line <a href="javascript:email..">.. part inside your blog. This will call the email function.
You can see a working sample at http://balajidl.blogspot.com/ under the topic file extensoin check, click My email id.
Regards
Balaji
Comment from balaji on 02 February 2006 13:40:15 CET
Hi Balaji
Thanks for your kind reply
Got it working
Cheers
Thanks for your kind reply
Got it working
Cheers
Comment from vishnu on 03 February 2006 13:11:32 CET
many companys send adds in my id
how to protect my spam of this type of adds
please tellme solution
thankyou
Comment from syam on 14 September 2007 13:45:58 CEST
TrackBack to http://radio.javaranch.com/balajidl/addTrackBack.action?entry=1138700844108