Merge pull request #8818 from adullact/feat-smtp-emails

feat: allow classic SMTP for email sending
This commit is contained in:
mfo 2023-03-30 06:44:43 +00:00 committed by GitHub
commit 0279966a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -82,6 +82,15 @@ MATOMO_HOST="matomo.example.org"
MAILJET_API_KEY=""
MAILJET_SECRET_KEY=""
# Classic SMTP
CLASSIC_SMTP_ENABLED="disabled"
SMTP_HOST=""
SMTP_PORT=""
SMTP_USER=""
SMTP_PASS=""
SMTP_TLS=""
SMTP_AUTHENTICATION="plain"
# Alternate SMTP Provider: SendInBlue/DoList
SENDINBLUE_CLIENT_KEY=""
SENDINBLUE_SMTP_KEY=""

View file

@ -77,6 +77,17 @@ Rails.application.configure do
config.action_mailer.delivery_method = :mailtrap
elsif ENV['MAILCATCHER_ENABLED'] == 'enabled'
config.action_mailer.delivery_method = :mailcatcher
elsif ENV['CLASSIC_SMTP_ENABLED'] == 'enabled'
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: ENV.fetch("SMTP_HOST"),
port: ENV.fetch("SMTP_PORT"),
domain: ENV.fetch("SMTP_HOST"),
user_name: ENV.fetch("SMTP_USER"),
password: ENV.fetch("SMTP_PASS"),
authentication: ENV.fetch("SMTP_AUTHENTICATION"),
enable_starttls_auto: ENV.fetch("SMTP_TLS").present?
}
else
sendinblue_weigth = ENV.fetch('SENDINBLUE_BALANCING_VALUE') { 0 }.to_i
dolist_weigth = ENV.fetch('DOLIST_BALANCING_VALUE') { 0 }.to_i