Web crawling is one of the primary sources of email address for spammers. Any web page you expose to the public internet will quickly be slurped up by web crawlers and parsed for email addresses. This happens with amazing alacrity. For example, I put up this email link at about 10am on a Monday morning, and received the first spam the following day at 1:13pm.
In your HTML header, between the <head> and </head> tags, add the mailto function, including the <script></script> tags:
function mailto(Name, Domain, UnderlinedText, Subject)
document.write('<a href="mailto:' + Name + '@' + Domain);
if (arguments.length == 4)
document.write('?subject=' + Subject);
document.write('\">' + UnderlinedText + '</a>');
Right click on this page and select View Source to see an example.
Anywhere on the HTML page where you wish to create an email link, you simply call the mailto function like this:
<script>mailto("MailboxName", "DomainName", "UnderLinedText", "EmailSubject");</script>
That's all there is to it.
Right click on this page and select View Source to see exactly how each of the links below was created.
Click to send email to Bob Smith.
Click to send email to Bob Smith with the subject "Hello World".
Putting the entire function in the HTML header on every page is tedious, so here's how to make it easier.
Store the mailto function in a text file, and name it JSlib.js. (This file must not contain <script> </script> tags.) Place this file in any directory you choose; the example below uses a directory named /Scripts.
Instead of typing in the entire mailto function in the HTML header, put this single line instead:
Now, when the browser loads the page, it inserts the entire JSlib.js file automatically.