The mailto tag in HTML provides a simple way for a website visitor to contact you by email using a hyperlink. For instance:
<a href="mailto:firstname.lastname@example.org">Email John Doe</a>
Unfortunately, if your website uses this tag — and most do — automated web crawlers will eventually find it and add your email address to their library of spam target lists.
document.write("<a href='mailto:" + emailname + "@" + emailserver + "'>");
document.write(emailname + "@" + emailserver);
document.write('Email John Doe');
This code breaks apart the elements of a typical HTML mailto line of code in a way that spam crawlers can’t re-assemble. Voila, you now have an email hyperlink that spam crawlers won’t find!