Encode Email

Available for Craft 3

Overview #

Encode Email makes multiple email obfuscation filters available in your templates. Currently supported are:

  1. encode
  2. rot13
  3. entities

Note: All filters return raw HTML so make sure you know your data is clean before you use these filters.

Encode Filter #

The encode filter will encode your email address and make it harder to be picked up off the page by spambots. Under the hood, the encode filter uses the same encoding technique as the Rot13 filter below. encode is just an easier name to remember.

Rot13 #

The rot13 filter encodes the string you pass to it using the Rot13 cipher and returns a javascript tag to decode it on the page.

To use it, you must first create a variable with the entire string you want to encode as a Twig string, and then run the rot13 filter on the variable you created:

{% set email = "<a href='mailto:[email protected]'>Your Name</a>" %}

{{ email | rot13 }}

To use this filter for email, your entire link tag must be wrapped in the filter. This is necessary because the filter returns a script tag and will break your link tag if you only include the email address itself. The rot13 filter will return code similar to the following example in your page code, however, your visitors will see the link tag as you defined it above.

<script type="text/javascript">document.write("<n uers=‘znvygb:[email protected]’>Lbhe Anzr</n>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));</script>

HTML Entities #

The entities filter encodes your content into HTML Entities. If you filter your email information with it like so:

<a href='{{ "mailto:[email protected]" | entities }}'>Your Name</a>

The code on your page will be output as HTML Entities, but your visitors will see the information that you defined above:

<a href='&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#121;&#111;&#117;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;'>Your Name</a>

Craft Services

Optimize Craft CMS to improve your workflows, impress your users, and acheive your business goals.

We have over 20,000 hours of Craft experience and work in close collaboration with businesses, agencies, and individuals to help make Craft CMS the best platform for you and your business. Save time and build a website that respects best practices and is designed to be scalable, maintainable, and grow with your online business and marketing needs.

Let's talk

Bring it on

  • Project Planning
  • Content Architecture
  • Data Migrations
  • Performance Optimization
  • API Integrations
  • Monthly Analysis
  • Digital Marketing Strategy

Make your life easier, your customers happy, and your business run more smoothly.

On top of our experience with the Sprout Plugin Suite, we’ve designed and built numerous custom plugins to help organizations address unique business and marketing challenges. From custom workflows to e-commerce to deep API integrations with customer databases, analytics, and cloud services, we can help build custom plugins suited to your specific needs.

Let's talk

Make things better

  • Custom Tooling
  • Improved Workflows
  • API Integrations
  • CRM Integrations
  • Email Marketing
  • Lead Generation Forms
  • E-Commerce & Donations

Spend more time focused on your business. We’ll spend the time to focus on your website.

Maintaining your website, content strategy, and customer relationships have a large impact on your business. Whether you’re a business owner, marketing director, or content author, we can help keep things running smoothly. We offer on-call and monthly retainer services to help you answer burning questions, fix annoying bugs, update software, monitor analytics, and even come running if there’s a fire.

Let's talk

We've got your back

  • General questions
  • Design changes
  • Bugfixes
  • Craft updates
  • Plugin updates
  • Coaching and Training

Build your roadmap to improve performance, usability, and identify new business opportunities.

Curious how your Craft website stacks up against all the other Craft sites out there? As a digital agency and CMS specialists who have worked with Craft since day one, our team can provide you insight into everything from content architecture to code debt. Request an audit to learn about optimization opportunities and provide a path for your business to create a better user experience and a more targeted digital strategy.

Request an Audit

Know where you stand

  • Craft Best Practices
  • Usability Audits
  • Code Audits
  • Security Audits
  • Server Audits
  • SEO Audits