• # July 22, 2009 at 8:17 am

    Hi guys,

    Was wondering – how do you obfuscate the e-mail addresses on your pages? I found some really nice ideas over here: … -compared/
    ..but that does not cover wrapping the e-mail address in an anchor ( So how do you do this?

    I was actually looking for a non-javascript solution.



    # July 22, 2009 at 10:04 am

    This reply has been reported for inappropriate content.

    There really is no solution, especially without javascript and even then there are all sorts of accessibility issues.
    I recommend people use a contact form and if they insist on having a ‘mail to’ link I just warn them to expect lots of spam.
    Whatever you do the spammers will always be one step ahead.

    # July 22, 2009 at 8:31 pm

    I seriously cannot be the only one ever to think of this?!!!!
    Maybe so. I just thought of this now, tested it and it works

    Make an anchor link go to something like and in that have the address code:

    < ?php header( 'Location:' ); ?>

    You could even get adventurous:

    < ?php $f = $_GET["f"]; $d = $_GET["d"]; $t = $_GET["t"]; header( 'Location: mailto:' . $f . '@' . $d . $t . '' ); ?>

    and make the anchor link hit

    Here’s a more compressed version of the code above to reduce file size:

    < ?php header('Location:mailto:'.$_GET["f"].'@'.$_GET["d"].$_GET["t"].'');?>

    So your final HTML markup would look something like this:

    Or even:

    # July 22, 2009 at 9:17 pm

    You’d have to sanitize the shit out of those variables, but it’s an interesting idea for sure.

    # July 22, 2009 at 9:33 pm

    cool. I’ve just thought I may launch a web app, similar to tinyurl for this sort of thing when I get the time

    # July 22, 2009 at 9:34 pm

    This is what I’ve been doing to hide my email address.

    1. I utilize this CSS class (below) which reverts the orientation of the content from right to left.

    .email {
    unicode-bidi: bidi-override;
    direction: rtl;

    2. Then, I convert ASCII characters to Unicode at

    3. The final code looks like:

    # July 22, 2009 at 11:13 pm


    I’m a hack when it comes to PHP. I understand what’s going on with the code here but can you explain "sanitize the shit out of those variables" please?


    # July 23, 2009 at 5:10 am
    "mvaughn" wrote:

    I’m a hack when it comes to PHP. I understand what’s going on with the code here but can you explain "sanitize the shit out of those variables" please?


    The PHP code from above takes GET variables and uses them to execute a bit of code, but because GET variables are very easy to manipulate you should always limit the input possibilities (‘sanitizing’). This security thingie is similar to SQL injection (the Wikipedia article explains more)

    @danilolee: There are crawlers/bots out there that can read out ASCII characters…

    @mattvot: your PHP solution sounds like something, but I’ll have to keep looking for a non-PHP solution as some of my clients have a hosting provider that does not support php :-/.
    I like your idea of the web app, I’d be glad to help you set up something for that. Just shoot me a PM.

    # July 23, 2009 at 7:29 pm

    You can use this PHP function I wrote to convert to ascii.

    function mailacsii($name, $domain, $link=NULL) {
    $email = $name . ‘@’ . $domain;
    if (!$link): $link = $email; endif;
    foreach (str_split($email) as $obj)
    $ascii .= ‘&#’ . ord($obj) . ‘;’;
    $output = ‘<a href="mailto:’ . $ascii . ‘">’. $link .'</a>’;
    return $output;
    <!– usage examples –>
    example a) <?php echo mailacsii(‘hello’, ‘’, ‘Send Email’); ?><br />
    example b) <?php echo mailacsii(‘hello’, ‘’); ?>

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.