Skip to content

Mailgun mailer class for SilverStripe (with optional logging of opens & bounces)

License

Notifications You must be signed in to change notification settings

restruct/silverstripe-mailgun-mailer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SilverStripe Mailer for sending mail via the Mailgun API

This module lets you send SilverStripe emails through the official Mailgun PHP library, falling back to PHP's built-in sendmail() if Mailgun is unreachable.

Requirements

  • PHP 5.4+
  • SilverStripe ~3.1
  • Mailgun-PHP
  • (optional) set up a manual cron task, or use silverstripe-crontask or silverstripe-queuedjobs(?) to keep log synced

Installation

Install with Composer. Learn how

composer require "micschk/silverstripe-mailer-mailgun:~1.0"

Documentation

You will need to provide a Mailgun API key for a verified domain that you have set up in your Mailgun account.

Also, if you want to synchronize the Mailgun log, you will need to set up some way to run/ Mailgun_SyncLogTask::poll() every not and then. This gets the Mailgun events log from the API and saves it to the local database so you can see when messages got sent, openend and/or bounced etc.

Example configuration

In your project's _config/config.yml file:

MailgunMailer:
  api_key: 'key-goes-here'
  api_domain: 'verified-domain'

In your project's _config.php file:

Injector::inst()->registerService(new MailgunMailer(), 'Mailer');

or:

// Send email through Mailgun in live environment only
if (Director::isLive()) {
	Injector::inst()->registerService(new MailgunMailer(), 'Mailer');
}

About

Mailgun mailer class for SilverStripe (with optional logging of opens & bounces)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%