Use Smarty to protect your email address
There are lots of different ways to protect your email address from spammers and email harvesters. The safest way of all is not to put your email details on your website at all. Turning your email address into an image is another way, although that also means that your visitors can’t click on the image to send you a message: they have to copy the address from the image instead.
You can also use Javascript or hex values to encode your address, but it can take a while to find a suitable code snippet to use.
Blogsome users have another option: Smarty code. It’s easy, and here’s how to do it. Let’s suppose your real email address is **me@example.com**. Choose from one of the following:
Firstly, there’s this:
{mailto address="me@example.com" encode="javascript"}
Anyone looking at your blog source code will see this:
<script type="text/javascript">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e%27%29%3b'))</script>
Or you could try doing this:
{mailto address="me@example.com" encode="hex"}
which looks like this:
<a href="mailto:%6d%65@%65%78%61%6d%70%6c%65.%63%6f%6d" >me@example.com</a>
And finally there’s this:
{mailto address="me@example.com" encode="javascript_charcode"}
which returns this in the source code:
<script type="text/javascript" language="javascript">
<!--
{document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))}
//-->
</script>
useful tips, thanks chris. into which html file should I edit the code?
April 18, 2008
Just put the code (in your index.html file) wherever you would usually put your email address.
April 24, 2008