This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Learn » eZ Publish » Encapsulating e-mails for usability...

Encapsulating e-mails for usability and spam protection

Tuesday 26 October 2010 10:15:03 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Step 2 : Adding usability using jQuery

Enabling jQuery at an eZPublish project can be done by activating the eZ JS Core certified extension as you would with any extension in eZ Publish. For more information, see You could also add the jQuery JS code in your pagelayout (visit

The jQuery code that deals with the <div> is:

<script type="text/javascript">
                //scrambles mails with [@] and [punto]                
                var spt = $('div#mail');
                var at = " [@] ";
                var dot =" [punto] ";
                var addr = $(spt).text().replace(at,"@").replace(dot,".");
                $(spt).after( '<a href="mailto:' + addr + '" title="Send an email">' +  addr + '</a>' ).hover( 
                           window.status = "Send a letter!";

You can also add within the js code some eZ code that fetches from the template.ini the values of EmailDotText and EmailAtText so whenever you change the definition at the .ini the jQuery works as well.

Once the jQuery runs you get a nicer and understandable e-mail "" at the frontend site with its own “mailto” once you hover over the link, but this time crawlers will not see it at all as the code is not understandable for them, as for users they will get the well-known e-mail addresses sequence as it should always be.

36 542 Users on board!

Tutorial menu


Printer Friendly version of the full article on one page with plain styles


Proudly Developed with from