PHPackages                             unclecheese/silverstripe-permamail - 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. unclecheese/silverstripe-permamail

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

unclecheese/silverstripe-permamail
==================================

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

1.3.2(8y ago)2014.8k9[4 issues](https://github.com/unclecheese/silverstripe-permamail/issues)[3 PRs](https://github.com/unclecheese/silverstripe-permamail/pulls)BSD-3-ClausePHP

Since May 9Pushed 8y ago4 watchersCompare

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

READMEChangelog (6)Dependencies (4)Versions (8)Used By (0)

SilverStripe Permamail
======================

[](#silverstripe-permamail)

====================== This module adds several enhancements to the core `Email` class in SilverStripe:

- Persisting sent emails in the database
- Allowing "resend" of emails
- Providing user-defined HTML templates for emails
- Send test emails, populated with your specific variables
- Send emails to a `DataList` of Members

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

[](#installation)

`composer require unclecheese/silverstripe-permamail:dev-master`

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

[](#requirements)

- SilverStripe 3.1.\*
- unclecheese/reflection-templates
- unclecheese/gridfield-betterbuttons:1.2.\*

Usage
-----

[](#usage)

By default, Permamail is injected as the class for `Email`, meaning `Email::create()` will instantiate a `Permamail` object instead of `Email`. Because `Permamail` is a subclass of `Email`, the API is exactly the same.

If you would like to use Permamail on a case-by-case basis, simply use `new Permamail()` and `new Email()` where you see fit, or override the injector setting in the configuration so that `Email` is the class used for `Email`.

### Example

[](#example)

```
$e = Email::create()
 	->setFrom('me@example.com')
 	->toMembers(Member::get())
 	->setSubject('Test email')
 	->setUserTemplate('my-template')
 	->populateTemplate(array(
 		'Member' => Member::get()->byID(2)
 	))
 	->send();
```

The API is exactly the same, with only two new methods:

- `toMembers()` accepts an array or `SS_List` of `Member` objects and uses their `Email` properties, sending an email to each one.
- `setUserTemplate()` accepts a string as the identifier of a user-defined template in the CMS. More information in the "Administration" section below.

The admin interface
-------------------

[](#the-admin-interface)

Permamail provides a new `ModelAdmin` interface called `Email`, which provides two tabs:

### Outbound Emails

[](#outbound-emails)

Shows a list of all emails sent. Offers an option to resend.

[![screenshot](https://cloud.githubusercontent.com/assets/654636/5621941/a9e07c5a-95a0-11e4-8cf3-1f2c16fac24f.png)](https://cloud.githubusercontent.com/assets/654636/5621941/a9e07c5a-95a0-11e4-8cf3-1f2c16fac24f.png)

[![screenshot](https://cloud.githubusercontent.com/assets/654636/5621942/aa16c4ea-95a0-11e4-9599-982b43f5c147.png)](https://cloud.githubusercontent.com/assets/654636/5621942/aa16c4ea-95a0-11e4-9599-982b43f5c147.png)

### Email templates

[](#email-templates)

Allows creation of user-defined templates, with default subjects and "From" addresses.

[![screenshot](https://cloud.githubusercontent.com/assets/654636/5621944/aa3abb20-95a0-11e4-9cb8-e7f6d457cd45.png)](https://cloud.githubusercontent.com/assets/654636/5621944/aa3abb20-95a0-11e4-9cb8-e7f6d457cd45.png)

### Sending test emails

[](#sending-test-emails)

[![screenshot](https://cloud.githubusercontent.com/assets/654636/5621943/aa38dabc-95a0-11e4-9c0e-c482b4b4e501.png)](https://cloud.githubusercontent.com/assets/654636/5621943/aa38dabc-95a0-11e4-9c0e-c482b4b4e501.png)

Every user-defined template can send a test email, and populate the template with the variables you have specified. To do this, the template uses the `ReflectionTemplate` class to gather all the variables and blocks in the template, and offers you the opportunity to customise what values are assigned to those variables. Options include:

- A static value (e.g. hardcoded)
- A random object from the database of a given ClassName
- A specific object from the database of a given ClassName

[![screenshot](https://cloud.githubusercontent.com/assets/654636/5621945/aa3d0556-95a0-11e4-96e0-239033322d55.png)](https://cloud.githubusercontent.com/assets/654636/5621945/aa3d0556-95a0-11e4-96e0-239033322d55.png)

#### Querying specific records to inject into your template

[](#querying-specific-records-to-inject-into-your-template)

To run a custom query, you can use a query string like an array is used in the `filter()` method of the ORM, for example: `Category=gardening&Title:StartsWith=A&Created:LessThan=2014-11-11`

Questions you may have
----------------------

[](#questions-you-may-have)

### What if I'm using a custom mailer, like Mandrill, or SendGrid?

[](#what-if-im-using-a-custom-mailer-like-mandrill-or-sendgrid)

No worries. This module doesn't override the mailer. It just overrides the `Email` class that wraps the Mailer.

### What about when the error logger sends out emails. I don't want to persist those to the database.

[](#what-about-when-the-error-logger-sends-out-emails-i-dont-want-to-persist-those-to-the-database)

The error logger does not use the Email class unless you're unit testing. True errors are sent via simple PHP `mail()`.

### Won't this pollute the database? My site sends a lot of email.

[](#wont-this-pollute-the-database-my-site-sends-a-lot-of-email)

For maintenance, use the `PermamailCleanupTask`. It accepts two parameters:

- `unit`: the unit of time to go back
- `count`: the number of units to go back

`/dev/tasks/PermamailCleanupTask?count=30&unit=days` will remove all emails that are more than 30 days old.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~157 days

Recently: every ~152 days

Total

6

Last Release

3234d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/654636?v=4)[Aaron Carlino](/maintainers/unclecheese)[@unclecheese](https://github.com/unclecheese)

---

Top Contributors

[![harrietgrace](https://avatars.githubusercontent.com/u/2074469?v=4)](https://github.com/harrietgrace "harrietgrace (1 commits)")[![nspyke](https://avatars.githubusercontent.com/u/901747?v=4)](https://github.com/nspyke "nspyke (1 commits)")

---

Tags

emailsilverstripe

### Embed Badge

![Health badge](/badges/unclecheese-silverstripe-permamail/health.svg)

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

###  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)[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)
