We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37242 ☆ A M B ☆
    • 339 Posts
    Hi MODX people,

    I wrote a small snippet for creating kind of secure email links. I followed this guide and here it is. It does not verify anything.

    create a new snipptet called emailLink
    $email = $scriptProperties['email'];
    
    if (empty($email)) {
        $modx->log(modX::LOG_LEVEL_DEBUG,'[emailLink] Empty email adress passed, aborting.');
        return '';
    }
    
    else {
    // Set placeholders:
    $modx->setPlaceholder('email', strrev($email));
    	
    return $modx->getChunk('emailLink');
    }


    the chunk is also called emailLink
    <span style="unicode-bidi:bidi-override;direction: rtl;"><a onclick="this.href='mailto:'+ this.innerHTML.split('').reverse().join('')" href="#">[[+email]]</a></span>


    call it like this:
    [[!emailLink? &email=`[email protected]`]]


    Hope you find it useful as I do smiley

    Cheers,

    Guido
      • 37242 ☆ A M B ☆
      • 339 Posts
      Just to let you know: I didnt receive a single spam email on the adresses where I used this.