From b158c9299802822aaf7fa0a82e310f13370acbb5 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 24 Aug 2018 14:03:21 +1000 Subject: [PATCH] Configure mail TLS or SSL connection when seeding This allows to seed the secure connection type of the default mail method. --- config/application.yml.example | 1 + db/seeds.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/application.yml.example b/config/application.yml.example index 266fe6b41e2..980d3f9b26f 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -30,6 +30,7 @@ SMTP_USERNAME: 'ofn' SMTP_PASSWORD: 'f00d' # Optional mail settings +# MAIL_SECURE_CONNECTION: 'TLS' # 'None' (default), 'SSL' or 'TLS' # MAILS_FROM: hello@example.com # MAIL_BCC: manager@example.com diff --git a/db/seeds.rb b/db/seeds.rb index e20112c7104..d285cbda014 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -42,7 +42,7 @@ def create_mail_method preferred_mail_auth_type: 'login', preferred_smtp_username: ENV.fetch('SMTP_USERNAME'), preferred_smtp_password: ENV.fetch('SMTP_PASSWORD'), - preferred_secure_connection_type: 'None', + preferred_secure_connection_type: ENV.fetch('MAIL_SECURE_CONNECTION', 'None'), preferred_mails_from: ENV.fetch('MAILS_FROM', "no-reply@#{ENV.fetch('MAIL_DOMAIN')}"), preferred_mail_bcc: ENV.fetch('MAIL_BCC', ''), preferred_intercept_email: ''