From cb3717294793e5b982d8b1f1144b2c636fc49fb8 Mon Sep 17 00:00:00 2001 From: Garion Herman Date: Mon, 29 Apr 2019 09:53:22 +1200 Subject: [PATCH] Use environment variables in example SMTP config Currently the email documentation provides an example of how to use the SMTP adapter in SwiftMailer, but this example hardcodes the password in the config file which is a security issue. It is possible to reference environment variables instead, so we should document and encourage this. --- docs/en/02_Developer_Guides/10_Email/index.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/en/02_Developer_Guides/10_Email/index.md b/docs/en/02_Developer_Guides/10_Email/index.md index 935363c22..99b6df1ed 100644 --- a/docs/en/02_Developer_Guides/10_Email/index.md +++ b/docs/en/02_Developer_Guides/10_Email/index.md @@ -18,7 +18,7 @@ SilverStripe\Core\Injector\Injector: Swift_Transport: Swift_SendmailTransport ``` -For example, to use SMTP, create a file app/_config/email.yml: +For example, to use SMTP, create a file `app/_config/email.yml`: ```yml --- @@ -34,11 +34,13 @@ SilverStripe\Core\Injector\Injector: Port: Encryption: tls calls: - Username: [ setUsername, [''] ] - Password: [ setPassword, [''] ] + Username: [ setUsername, ['`APP_SMTP_USERNAME`'] ] + Password: [ setPassword, ['`APP_SMTP_PASSWORD`'] ] AuthMode: [ setAuthMode, ['login'] ] ``` +Note the usage of backticks to designate environment variables for the credentials - ensure you set these in your `.env` file or in your webserver configuration. + ## Usage ### Sending plain text only