Spam mail is an unfortunate fact of life. The more things we sign up for, the more our addresses get sold as marketing lists. There is one area where we can try and minimise the collection of email addresses though and that is when pasting them on a website.
That was the question I asked myself when I started putting this site together. Part of it is Joomla, part is standard php pages, some Joomla pages call standard php files. So what to do?
My reasoning basically went along these lines. Make the link empty. Only add the email address when the user interacts with the link. That way, anything scanning the page will see nothing, a user who wants to click on the link will get the email address.
So my link looks like this:
<a href="#" class="emailMe">link text</a>
//hide my email until hover
$('a.emailMe').attr("href", "mailto:firstname.lastname@example.org?subject=Mail&;nbsp;from Website");
This is obviously only going to work with 1 email address and you don't want to be writing a new function for each address, but with a little bit of thought it is not hard to expand the usage for multiple addresses.
So far, not 1 spam email. I hope publishing this doesn't change that.