From 95b44d840d3f2a6fd6489df0fe1966249d9345f4 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Wed, 13 Feb 2019 15:37:34 +0700 Subject: [PATCH] DOCS Add example for disabling emails in dev mode via configuration [ci skip] --- docs/en/02_Developer_Guides/10_Email/index.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/en/02_Developer_Guides/10_Email/index.md b/docs/en/02_Developer_Guides/10_Email/index.md index 4fc535797..935363c22 100644 --- a/docs/en/02_Developer_Guides/10_Email/index.md +++ b/docs/en/02_Developer_Guides/10_Email/index.md @@ -198,6 +198,22 @@ $email->getSwiftMessage()->getHeaders()->addTextHeader('HeaderName', 'HeaderValu See this [Wikipedia](http://en.wikipedia.org/wiki/E-mail#Message_header) entry for a list of header names. +## Disabling Emails + +If required, you can also disable email sending entirely. This is useful for testing and staging servers where +you do not wish to send emails out. + +```yaml +--- +Name: myemailconfig +Only: + Environment: dev +--- +SilverStripe\Core\Injector\Injector: + Swift_Transport: + class: Swift_NullTransport +``` + ## SwiftMailer Documentation For further information on SwiftMailer, consult their docs: http://swiftmailer.org/docs/introduction.html