2

I'm working on a site that will have various email addresses entered within paragraphs of text in channel entries by the client.

These email address are automatically turned into links by EE which is great, but I'm struggling to find a way to protect these email addresses from spammers.

I've heard that EE can do this but have struggled to find any information about how to set EE to do this automatically without using the 'encode' tag (which is going to be too complex for the client).

Does anyone know how to set EE to protect or encrypt email addresses contained within channel entries automatically? Or alternatively, does anyone know of any plugins that might help?

As always, any thoughts or ideas are appreciated.

Thanks in advance,

Tom

4

The WYGWAM field has this setting option. I just used it on my last project. Worked perfectly.

enter image description here

| improve this answer | |
1

For those users who do not use WYGWAM take a look at CE String which elegantly solves this issue. (and lots more - a real swiss army chainsaw to use a Perl expression)

http://dvt.ee/cestring

In the custom method docs take a look at 'encode_email_script' or encode_email_bulk

http://www.causingeffect.com/software/expressionengine/ce-string/user-guide/custom_methods

To quote the docs for usage of 'encode_email_bulk':

{exp:ce_str:ing encode_email_bulk="script"}
    Ut wisi <a href="mailto:example@example.com">Example</a> enim ad minim veniam, quis nostrud test@example.com.
{/exp:ce_str:ing}

Output:

Ut wisi <span data-eeEncEmail_GDleXCqLAm='1'>.(JavaScript must be enabled to view this email address)</span><script type="text/javascript">/*<![CDATA[*/var out = '',el = document.getElementsByTagName('span'),l = ['>','a','/','<',' 101',' 108',' 112',' 109',' 97',' 120',' 69','>','\"',' 109',' 111',' 99',' 46',' 101',' 108',' 112',' 109',' 97',' 120',' 101',' 64',' 101',' 108',' 112',' 109',' 97',' 120',' 101',':','o','t','l','i','a','m','\"','=','f','e','r','h','a ','<'],i = l.length,j = el.length;while (--i >= 0){out += unescape(l[i].replace(/^\s\s*/, '&#'));}while (--j >= 0){/**/if (el[j].getAttribute('data-eeEncEmail_GDleXCqLAm')){el[j].innerHTML = out;}}/*]]>*/</script> enim ad minim veniam, quis nostrud <span data-eeEncEmail_qxlETSuEFT='1'>.(JavaScript must be enabled to view this email address)</span><script type="text/javascript">/*<![CDATA[*/var out = '',el = document.getElementsByTagName('span'),l = ['>','a','/','<',' 46',' 109',' 111',' 99',' 46',' 101',' 108',' 112',' 109',' 97',' 120',' 101',' 64',' 116',' 115',' 101',' 116','>','\"',' 46',' 109',' 111',' 99',' 46',' 101',' 108',' 112',' 109',' 97',' 120',' 101',' 64',' 116',' 115',' 101',' 116',':','o','t','l','i','a','m','\"','=','f','e','r','h','a ','<'],i = l.length,j = el.length;while (--i >= 0){out += unescape(l[i].replace(/^\s\s*/, '&#'));}while (--j >= 0){/**/if (el[j].getAttribute('data-eeEncEmail_qxlETSuEFT')){el[j].innerHTML = out;}}/*]]>*/</script>
| improve this answer | |
0

how do you confirm this is actually working? If I disable javascript the email links look the same in the source

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.