The days of the mailto: email link should be long gone, but unfortunately there are still millions of those type of links out there. I don’t necessarily mean unfortunately for you or me; I mean unfortunately for the millions of people who are the poor recipients of email from such links out there.
There are thousands of nasty little spambots out there just searching the web hour after hour, zeroing in on that little snippet of code known as a mailto: email link. Bingo, when they find one, the email address that comes immediately after mailto: in the link will be massively bombarded over time with spam. Did you ever really wonder how that poor widow in Nigeria got your email address?
Every good web design company has an even better web programmer. That web programmer can spend up to 1/3 of his or her time just trying to stay one step ahead of the hackers and spammers. In larger companies, it can be a full time job.
The mailto: spam debacle is generally one of the easier problems to troubleshoot, and I’ve seen many different workarounds.
Some people just type out their email address but don’t make it a link. This is fine, but it forces the person who wants to email you to have to write it down, or copy it over to their email program in order to email you. That’s where human error enters the picture.
Some are even afraid to type out their full email address on a web page so they take that human error factor one step deeper and tell people to email them at myname at mysite.com.
Now, I’ve also seen some ingenious workarounds. I’ve seen code that turns typed email addresses into images of the letters because the spambots can’t read text in images. That one is pretty cool!!! But it’s also pretty complicated for the average site.
My favorite solution is a simple javascript, placed in an external javascript page. I’m so fond of it that I’m about to share it with you. Copy and paste the following into your external javascript page, or just in the head area of your page:
<script type=”text/JavaScript”>
<!- –
function myEmail(prt1,prt2,id,subject){
//redirect to mailto
if (subject == undefined ){
window.location = ‘mailto:’+ prt1 +’@’+ prt2;
}else{
window.location = ‘mailto:’+ prt1 +’@’+ prt2 + ‘?Subject=’ + subject;
}
return false;
}
– ->
</script>
Now instead of the mailto: email link in the body of your document use this:
<a href=”javascript:void(0);” onClick=”myEmail(‘myname’,’mysite.com’,this,’Website Contact’);” title=”Click here to email us”>email us</a>
Now how cool is that?! And if you think about it, how much more simple could it be?
![]() |
I wish more people would write blogs like this that are really enjoyable to study. With all of the fluff floating about on the web, it’s rare to read a weblog like yours instead.
Wow! This can be one particular of the most helpful blogs We’ve ever arrive across on this subject. Actually Magnificent. I’m also an expert in this topic so I can understand your hard work.
The blog was absolutely fantastic! Lots of great information and inspiration, both of which we all need!
Excellent article and easy to understand explanation. How do I go about getting permission to post part of the article in my upcoming news letter? Giving proper credit to you the author and link to the site would not be a problem.
Major thanks for the article post. Will read on…
Every time I stumble upon a great blog post I usually do one of three thing:1.Forward it to all the close contacts.2.Bookmark it in all of the popular bookmarking websites.3.Make sure to return to the same website where I first read the article.After reading this article I’m really thinking of doing all of the above!
I thought it was going to be some boring previous post, but it seriously compensated for my time. I will publish a website link to this page on my weblog. I am certain my website visitors will discover that pretty useful.
Hi, i think that i saw you visited my blog thus i came to “return the favor”.I’m trying to find things to improve my website!I suppose its ok to use a few of your ideas!!
Interesting, I wonder what the statistics are on your first point there…