Prevent your email-address from the spam bots in WordPress

From the last several days I have lot of spam mails on the contact-us email address. After investigating, I have found several reasons: one of them is that I have place the email address on the contact page that was accessible by everyone include the spam bots also. Many Spam bots can find very easily your email address format using the several regular expression. So you need to protect your email address from the spam bots. If you have a wordpress site than you can use the antispambot() function to encrypt the email address.The function will encode the characters in your address to their HTML character entity.

If you are using template page directly then you can use the function like as:

<?php
echo antispambot("abc@abc.com");
?>

You can also create the short code for this, for it you need to add the following function in your function file(function.php)

// Code from the Wordpress codex
function HideMail($atts , $content = null ){
	if ( ! is_email ($content) )
		return;
 
	return '<a href="mailto:'.antispambot($content).'">'.antispambot($content).'</a>';
}
add_shortcode( 'email','HideMail');

[Source: WordPress Codex]

Than you can use the this short code in any page or post like as:

[email]abc@abc.com[/email]

You should check your site and make sure your email address is secure.