PHPackages                             taitava/silverstripe-cloakemail - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. taitava/silverstripe-cloakemail

ActiveSilverstripe-vendormodule[Mail &amp; Notifications](/categories/mail)

taitava/silverstripe-cloakemail
===============================

Module to easily encode email addresses inside templates, page content and PHP code so that SPAM bots can't understand them, but human readers see them clearly.

2.0.0(7y ago)23981[6 issues](https://github.com/Taitava/silverstripe-cloakemail/issues)1MITPHPCI failing

Since Sep 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Taitava/silverstripe-cloakemail)[ Packagist](https://packagist.org/packages/taitava/silverstripe-cloakemail)[ RSS](/packages/taitava-silverstripe-cloakemail/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (10)Used By (1)

silverstripe-cloakemail
=======================

[](#silverstripe-cloakemail)

Module to easily encode email addresses inside templates, page content and PHP code so that SPAM bots can't understand them, but human readers see them clearly.

Maintainer Contact
------------------

[](#maintainer-contact)

Jarkko Linnanvirta posti (at) taitavasti (dot) fi (in English or in Finnish) [www.taitavasti.fi](http://www.taitavasti.fi) (only in Finnish)

Requirements
------------

[](#requirements)

- SilverStripe 4.0.0 or greater
- PHP extensions: `json`
- jQuery (unless you use the `nojs` `mode`, but it's ugly)

Installation
------------

[](#installation)

The recommended way to install this module is by using `composer`:

```
composer require "taitava/silverstripe-cloakemail:*"

```

Documentation
-------------

[](#documentation)

This module makes it easy to cloak email addresses in webpage content and templates to prevent SPAM bots from getting them. The module uses JavaScript + jQuery to reveal the email addresses, although this can be turned off if you don't wish to bloat your website with JavaScript.

The following datatypes are extended to be able to cloak email addresses: text, varchar and enum. To cloak an email address in a template file, just trail the variable containing the email address with .Cloak().

For example:

```
$SiteConfig.ContactEmailAddress.Cloak()

```

You can also use $Cloak('') inside a template (only inside a Page context).

Email addresses in Page objects' contents are cloaked automatically, but only if page\_content is set to true in cloakemail.yml.

Configuration
-------------

[](#configuration)

*app/\_config/cloakemail.yml*

```
---
after: cloakemail
---
Taitava\CloakEmail\CloakEmail:
  mode: simple
  convert_page_content: true
  page_insert_links: false
  template_insert_links: false
  purge_mailto_links: true
  at: ' [a] '
  dot: ' [dot] '
  hard_noscript_error: 'JavaScript must be turned on in order to see this email address'

```

### mode

[](#mode)

There are multiple cloaking modes:

- hard: Impossible for SPAM bots to get around if they can't interpret JavaScript. Without JavaScript support, the user cannot see the email address in any form.
- simple: Cloaks the email address in a human readable way:  becomes to something like my (dot) name (a) my (dot) place. However, JavaScript is used to reverse it to the original form to make it user friendly in the browser. If JavaScript is turned off, the user can still see it in the cloaked format. This is the best compromise for fallback ability, user friendliness and performance.
- nojs: Same as 'simple', but no JavaScript is used.
- none: Makes no changes to email addresses. Good for debugging.

Default: 'simple'

### convert\_page\_content

[](#convert_page_content)

If true, CloakEmail processes page content and cloaks all email addresses in Page objects' contents automatically.

WARNING! This feature can easily break things. A simple email address just laying around between text should work just fine, but if an email address resides inside an HTML tag (for example [Feedback](mailto:send.mail@to.me)) it will break the tag because it fills in its own HTML code! Exception: \[i\]nojs\[/i\] mode does not fill in any HTML code unless you have \[i\]page\_insert\_links\[/i\] set to true.

Default: false

### page\_insert\_links and template\_insert\_links

[](#page_insert_links-and-template_insert_links)

If true, wraps cloaked email addresses inside mailto-links ([*CLOAKED ADDRESS*]()). However, this is not done if \[i\]mode\[/i\] is set to \[i\]none\[/i\].

Default: false for both variables

### purge\_mailto\_links

[](#purge_mailto_links)

The purpose of this option is to prevent malformed HTML code from being generated if set to true and if the source HTML content contains email address links like `email@address.com`. If this option is off, the module would convert the email address in the `href` attribute in a way that would insert HTML inside the attribute, which would simply break the outputted HTML.

This option provides a "quirky" workaround to this problem by removing all mailto links from the HTML content before starting to process it. So it replaces the link with the email address found from the `href` attribute. **Please note that the anchor text of the link is not preserved in any way!**

You can use page\_insert\_links and/or template\_insert\_links options to recreate the mailto links, but you still can't get the original anchor texts back, instead the email address itself will be used as the anchor text - which is usually correct.

So while this feature does not perfectly fix the bug that it relates to, at least it offers a better-than-nothing solution. If you want to start a discussion about this topic, please see the issue #3 . Please do not hesitate to ask if you have any questions about this feature/bug! :)

Default: false

### at and dot

[](#at-and-dot)

@ and . will be replaced with these strings in email addresses when mode is either 'simple' or 'nojs'. In 'hard' mode these are not used, because the email addresses get totally scrambled in that mode. HTML code is allowed here.

Defaults: ' at ' and ' dot '

### hard\_noscript\_error

[](#hard_noscript_error)

Error message that will be shown if JavaScript is turned off. This only affects 'hard' mode. The message appears in the place of the email address.

Default: 'JavaScript must be turned on in order to see this email address.'

TODO
----

[](#todo)

Here is a list of some ideas. I make no promises about future development, but I gadly welcome pull requests if you want to implement these or your own ideas! :)

- Improve the performance of cloaking email addresses in Page Objects' contents.
- Make it possible to change \[i\]mode\[/i\] and \[i\]insert\_link\[/i\] settings temporarily on .Cloak() calls in templates.
- Create a translation file and move \[i\]hard\_noscript\_error\[/i\] there
- Write a bit more JavaScript and drop jQuery to make the module lighter.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~215 days

Recently: every ~176 days

Total

7

Last Release

2611d ago

Major Versions

1.1.0 → 2.0.02019-01-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/611d4d836f6db7ba7357ea174bf48ab8cf86af5ac40be4a7a6101e67267333f9?d=identicon)[taitava](/maintainers/taitava)

---

Top Contributors

[![Taitava](https://avatars.githubusercontent.com/u/13002142?v=4)](https://github.com/Taitava "Taitava (24 commits)")

---

Tags

emailsilverstripespamhidebothide emailcloak

### Embed Badge

![Health badge](/badges/taitava-silverstripe-cloakemail/health.svg)

```
[![Health](https://phpackages.com/badges/taitava-silverstripe-cloakemail/health.svg)](https://phpackages.com/packages/taitava-silverstripe-cloakemail)
```

###  Alternatives

[markguinn/silverstripe-email-helpers

Silverstripe extension containing SMTP mailer class and some other classes for HTML emails

3145.4k1](/packages/markguinn-silverstripe-email-helpers)[unclecheese/silverstripe-permamail

Adds database storage of emails and CMS definition of email templates.

2014.8k](/packages/unclecheese-silverstripe-permamail)[camfindlay/apes

The Automated Provision of Email Services (APES) module will allow you to set up an automated sync mechanism between the SilverStripe Member DataObject and MailChimp.

122.6k](/packages/camfindlay-apes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
