DOCS Add example for disabling emails in dev mode via configuration

[ci skip]
This commit is contained in:
Robbie Averill 2019-02-13 15:37:34 +07:00
parent b8122f88c5
commit 95b44d840d

View File

@ -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.
</div>
## 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