PHPackages                             markguinn/silverstripe-email-helpers - 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. markguinn/silverstripe-email-helpers

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

markguinn/silverstripe-email-helpers
====================================

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

1.3.2(9y ago)3145.4k22[11 issues](https://github.com/markguinn/silverstripe-email-helpers/issues)1PHPCI failing

Since Mar 5Pushed 5y ago6 watchersCompare

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

READMEChangelog (7)Dependencies (4)Versions (8)Used By (1)

SilverStripe Email Helpers
==========================

[](#silverstripe-email-helpers)

[![Build Status](https://camo.githubusercontent.com/ac6ddf533b3fef1cc3c6908bc957b0692e1675739326eeb0e2261729e77f2a55/68747470733a2f2f7472617669732d63692e6f72672f6d61726b6775696e6e2f73696c7665727374726970652d656d61696c2d68656c706572732e737667)](https://travis-ci.org/markguinn/silverstripe-email-helpers)

Contains replacement Mailer object that utilizes PHPMailer to send e-mail via SMTP instead of php's mail() function. Optionally, TLS can be enabled for secure communication with the SMTP server and a charset for the e-mail encoding can be specified. In addition, embedded CSS, plus a specified external CSS file, can be inlined into the email's HTML.

Also includes a drop-in replacement for the Email class called StyledHtmlEmail. If used with HTML emails it allows you to include a style section at the top of the email which will then be inlined as style attributes on the actual html tags to promote better compatibility across email clients.

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

[](#requirements)

Silverstripe 3.0+

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

[](#installation)

Install via composer:

```
composer require markguinn/silverstripe-email-helpers:dev-master

```

This module installs PHPMailer and Emogrifier:

-
-

Usage
-----

[](#usage)

### SMTP Mailer

[](#smtp-mailer)

To use the SMTP mailer add the following code to your \_config.php:

```
$encryption = 'tls'; // use tls
$charset = 'UTF-8'; // use specified charset if set
// you can specify a port as in 'yourserver.com:587'
$mailer = new SmtpMailer('yourserver.com', 'username', 'password', $encryption, $charset);
Email::set_mailer($mailer);  // or Injector::inst()->registerService($mailer, 'Mailer');
```

Alternatively, any of these can be set using the config system like so:

```
SmtpMailer:
  host: yourserver.com
  user: username
  password: password
  encryption: tls
  charset: UTF-8

```

And then in \_config.php:

```
Email::set_mailer( new SmtpMailer() );
```

### Emogrified Smtp Mailer

[](#emogrified-smtp-mailer)

If you wish to embed CSS into your email's HTML then use the `EmogrifiedSmtpMailer` class. Add the following code to your \_config.php:

```
$encryption = 'ssl'; // use ssl
$charset = 'UTF-8';
$externalcssfile = 'themes/{yourtheme}/css/externalcssfile.css';  // specify the path to your css file
$SMTPDebug = 2;  // Levels 0-4 available
$logfailedemail = true;  // Log a notice with PHPMailer's error information
$mailer = new EmogrifiedSmtpMailer('yourserver.com', 'username', 'password', $encryption, $charset, $externalcssfile, $SMTPDebug, $logfailedemail);
Email::set_mailer($mailer);  // or Injector::inst()->registerService($mailer, 'Mailer');
```

Alternatively, any of these can be set using the config system like so:

```
EmogrifiedSmtpMailer:
  host: yourserver.com
  user: username
  password: password
  encryption: ssl
  charset: UTF-8
  cssfile: 'themes/{yourtheme}/css/externalcssfile.css'
  SMTPDebug: 2
  logfailedemail: true

```

And then in \_config.php:

```
Email::set_mailer( new EmogrifiedSmtpMailer() );
```

### Styled Html Email

[](#styled-html-email)

To use the styled email, just literally use the StyledHtmlEmail class where you'd normally use the Email class and add a single style tag in the body of the email. For example:

```

.bigred {
	color: red;
	font-size: 30px;
}

Hello CUSTOMERS.
```

Would be sent as:

```
Hello CUSTOMERS.
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~246 days

Recently: every ~96 days

Total

7

Last Release

3339d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/485dfc9fc93cad085c83c3276f19b6e9322ee910ab0e1685de0db42228dbf97b?d=identicon)[markguinn](/maintainers/markguinn)

---

Top Contributors

[![AntonyThorpe](https://avatars.githubusercontent.com/u/1023740?v=4)](https://github.com/AntonyThorpe "AntonyThorpe (6 commits)")[![markguinn](https://avatars.githubusercontent.com/u/495837?v=4)](https://github.com/markguinn "markguinn (5 commits)")[![bummzack](https://avatars.githubusercontent.com/u/1006185?v=4)](https://github.com/bummzack "bummzack (4 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (3 commits)")[![zaucker](https://avatars.githubusercontent.com/u/198038?v=4)](https://github.com/zaucker "zaucker (3 commits)")[![gherkins](https://avatars.githubusercontent.com/u/824927?v=4)](https://github.com/gherkins "gherkins (1 commits)")[![catharsisjelly](https://avatars.githubusercontent.com/u/510747?v=4)](https://github.com/catharsisjelly "catharsisjelly (1 commits)")[![christopherdarling](https://avatars.githubusercontent.com/u/178039?v=4)](https://github.com/christopherdarling "christopherdarling (1 commits)")[![adrhumphreys](https://avatars.githubusercontent.com/u/10803137?v=4)](https://github.com/adrhumphreys "adrhumphreys (1 commits)")[![oliverklee](https://avatars.githubusercontent.com/u/765746?v=4)](https://github.com/oliverklee "oliverklee (1 commits)")

---

Tags

emailsilverstripesmtpemogrifier

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/markguinn-silverstripe-email-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/markguinn-silverstripe-email-helpers/health.svg)](https://phpackages.com/packages/markguinn-silverstripe-email-helpers)
```

###  Alternatives

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