From 5a38ae488ef0a19be892d58f2768155083f610fc Mon Sep 17 00:00:00 2001 From: Jordi Molina Date: Tue, 22 Sep 2020 17:03:47 +0200 Subject: [PATCH] Allow customization of test email recipient (#2107) * Update configuration.rake use env variable SMTP_TEST_RECIPIENT so customers using mail providers like Microsoft can specify RFC 2606 compliant destination test recipients * add SMTP_TEST_RECIPIENT to sample.env add SMTP_TEST_RECIPIENT to sample.env with default value to ensure retro compatibility * default to notifications@example.com default to notifications@example.com should SMTP_TEST_RECIPIENT not be defined Co-authored-by: Ahmad Farhat --- lib/tasks/configuration.rake | 2 +- sample.env | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tasks/configuration.rake b/lib/tasks/configuration.rake index f1203557..d3883ed3 100644 --- a/lib/tasks/configuration.rake +++ b/lib/tasks/configuration.rake @@ -49,7 +49,7 @@ def test_smtp authtype = ENV['SMTP_AUTH'].present? && ENV['SMTP_AUTH'] != "none" ? ENV['SMTP_AUTH'] : nil smtp.start(ENV['SMTP_DOMAIN'], user, password, authtype) do |s| - s.sendmail('test', ENV['SMTP_USERNAME'], 'notifications@example.com') + s.sendmail('test', ENV['SMTP_USERNAME'], ENV.fetch('SMTP_TEST_RECIPIENT', 'notifications@example.com')) end rescue => e failed("Error connecting to SMTP - #{e}") diff --git a/sample.env b/sample.env index 4a7d74b1..dd469e1a 100644 --- a/sample.env +++ b/sample.env @@ -138,6 +138,10 @@ SMTP_STARTTLS_AUTO= # Specify the email address that all mail is sent from SMTP_SENDER= +# Specify the recipient for test emails (needed for providers like Microsoft, who are very +# strict about RFC 2606) +SMTP_TEST_RECIPIENT=notifications@example.com + # Prefix for the applications root URL. # Useful for deploying the application to a subdirectory, which is highly recommended # if deploying on a BigBlueButton server. Keep in mind that if you change this, you'll @@ -282,4 +286,4 @@ DEFAULT_REGISTRATION=open # GCS_CLIENT_ID= # GCS_CLIENT_CERT= # GCS_PROJECT= -# GCS_BUCKET= \ No newline at end of file +# GCS_BUCKET=