© 2000 - 2017 Estatement Ltd

Protect your email address!

Use this tool to convert your email address into pure HTML codes. Currently the mail harvesters are ignoring this type of email address but the browsers have no problems.

To add a subject to an email add ?subject=wassup to the end of the email address. If the subject needs a space add it as %20 in the email address and a space in the label.

Now, that code is pretty ugly to have littered through your code so if you have a dynamic page, ie PHP, ASP or Perl you can store the email addresses in variables and then call them when you need them.

PHP Example.

Throughout your site you give contact details of the person or department responsible for the area being discussed. If the email changes then you want to be able to update that info in a single place, even more imporant when the email is hard to read.

So I'd have a script called funcs.php which is included into every page and in there I'd have this function:

<?php
function getEmail1($name)
{
    
$names = array();
    
$names['sales'] = "<a href='&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#97;&#108;&#101;&#115;&#64;&#109;&#121;&#115;&#105;&#116;&#101;&#46;&#99;&#111;&#109;'>&#115;&#97;&#108;&#101;&#115;&#64;&#109;&#121;&#115;&#105;&#116;&#101;&#46;&#99;&#111;&#109;</a>";
    
$names['returns'] = "<a href='&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#114;&#101;&#116;&#117;&#114;&#110;&#115;&#64;&#109;&#121;&#115;&#105;&#116;&#101;&#46;&#99;&#111;&#109;'>&#114;&#101;&#116;&#117;&#114;&#110;&#115;&#64;&#109;&#121;&#115;&#105;&#116;&#101;&#46;&#99;&#111;&#109;</a>";
    
$names['support'] = "<a href='&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#117;&#112;&#112;&#111;&#114;&#116;&#64;&#109;&#121;&#115;&#105;&#116;&#101;&#46;&#99;&#111;&#109;'>&#115;&#117;&#112;&#112;&#111;&#114;&#116;&#64;&#109;&#121;&#115;&#105;&#116;&#101;&#46;&#99;&#111;&#109;</a>";
    if (isset(
$names[$name])) $email $names[$name];
    else 
$email $names['sales']; //the default
    
return $email;
}
?>

So now as I create my website I can just pop in a

echo getEmail1('sales');

as I go and the correct email will be passed back. If it's for an email I haven't yet generated then the sales email will be given.

sales@mysite.com

Dynamic Sites

Now, if you have the ability to add functions in your code then getEmail could well look like this instead:

<?php
function getEmail2($name)
{
   
$name .= '@mysite.com';
   
$email getOrdString('mailto:'.$name);
   
$label getOrdString($name);
   return 
"<a href='{$email}'>{$label}</a>";
}

function 
getOrdString($string)
{
   for(
$i=0;$i<strlen($string);$i++)
   { 
     
$bit $string[$i]; 
        
$output .= '&#'.ord($bit).';';
   }
  return 
$output;
}
//function getOrdString($string)
?>

So now as I create my website I can just pop in a

echo getEmail2('sales');

and the email addresses will be dynamically generated.