Merge pull request #8798 from creative-commoners/pulls/4/disabling-emails-docs

DOCS Add example for disabling emails in dev mode via configuration
This commit is contained in:
Loz Calver 2019-02-13 09:17:40 +00:00 committed by GitHub
commit 4b07caf05f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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. See this [Wikipedia](http://en.wikipedia.org/wiki/E-mail#Message_header) entry for a list of header names.
</div> </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 ## SwiftMailer Documentation
For further information on SwiftMailer, consult their docs: http://swiftmailer.org/docs/introduction.html For further information on SwiftMailer, consult their docs: http://swiftmailer.org/docs/introduction.html