email address on your website
This is something that people don’t seem to realise, and although I tell them over and over it seems to go ignored.
DO NOT PUT YOUR EMAIL ADDRESS ON YOUR WEBSITE
The reason is that spam bots crawl websites and gather email addresses, then place them into a list ready to spam.
People often ask me how to overcome this issue, I mainly use the following 3 methods:
- Add removable tags. (eg: web@[-REMOVE-]hm2k.org)
- Images – Simply turn your email address into an image and include it on your site, be warned however, some spam bots use OCR, but not very often as it uses lots of resources.
- Forms – One of the best methods, because your email address is never visible, however forms can be spammed.
For those with some PHP skills here’s a simple script I made, you can use to render your email addresses, as per option 2:
<?php $string=$_GET['text']; $fixedhost=str_replace('www.','',$_SERVER['HTTP_HOST']); //check for string if (!$string) { die(); } $string=$string.'@'.$fixedhost; //ensure no caching by browser - START header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //A Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // no cache for HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); // no cache for HTTP/1.1 header("Pragma: no-cache"); // no cache for HTTP/1.0 //ensure no caching by browser - END //output the image header('Content-type: image/gif'); // tell the browser that this is an image //Create the image $font = 3; $width = ImageFontWidth($font)* strlen($string); $height = ImageFontHeight($font); $im = ImageCreate($width,$height); $x=imagesx($im)-$width ; $y=imagesy($im)-$height; $background_color = imagecolorallocate ($im, 242, 242, 242); //white background $text_color = imagecolorallocate ($im, 0, 0,0);//black text $trans_color = $background_color;//transparent colour imagecolortransparent($im, $trans_color); imagestring ($im, $font, $x, $y, $string, $text_color); imagegif($im); ImageDestroy($im); ?>
Update: I recently also write some javascript that is not easily detectable by the spam bots…
<script language=”JavaScript” type=”text/javascript”>
<!–
var who = ‘info’;
var at = ‘@’;
URL=self.location.href;
prefix=URL.substring(0,URL.indexOf(‘.’)+1);
URLremain=URL.substring(prefix.length,URL.length);
domain=”;
if((prefix==’http://www.’) || (prefix==’www.’)) {
domain=URLremain.substring(0,URLremain.indexOf(‘/’));
}
else {
prefix2=URL.substring(0,7);
if (prefix2==’http://’) {
URLremain2=URL.substring(prefix2.length,URL.length);
domain=URLremain2.substring(0,URLremain2.indexOf(‘/’));
}
else{ domain=URL.substring(0,URL.indexOf(‘/’)); }
}
document.write(who + at + domain);
//–>
</script>
It pulls the domain name automatically, ideal for many simple sites.
There are plenty of other techniques, csarven has a very nice article detailing these, called hiding email addresses.
Warning: Declaration of Social_Walker_Comment::start_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::start_lvl(&$output, $depth = 0, $args = Array) in /Users/wade/Sites/hm2k.org/wp-content/plugins/social/lib/social/walker/comment.php on line 18
Warning: Declaration of Social_Walker_Comment::end_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::end_lvl(&$output, $depth = 0, $args = Array) in /Users/wade/Sites/hm2k.org/wp-content/plugins/social/lib/social/walker/comment.php on line 42
Hey., thanks so much for the post! I really like the email-to-image script! I might have to use it on my website.
This article is quite outdated.
Try the Obfuscate Email PHP Library: http://obfuscate.sourceforge.net/