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 <ahmad.af.farhat@gmail.com>
This commit is contained in:
Jordi Molina
2020-09-22 17:03:47 +02:00
committed by GitHub
parent 75b989240a
commit 5a38ae488e
2 changed files with 6 additions and 2 deletions

View File

@ -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}")