Allow smtp port to be customizable via SMTP_PORT

This commit is contained in:
Hugo Peixoto 2023-11-13 08:48:28 +00:00
parent 066bf32e0c
commit 5c35572d29
3 changed files with 6 additions and 4 deletions

View File

@ -45,12 +45,12 @@ Rails.application.configure do
config.action_mailer.smtp_settings = {
address: ENV['SMTP_ADDRESS'],
port: 587,
port: ENV.fetch('SMTP_PORT', "587").to_i,
domain: ENV['SMTP_DOMAIN'],
user_name: ENV['SMTP_USERNAME'],
password: ENV['SMTP_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true,
enable_starttls_auto: ENV.fetch("SMTP_STARTTLS", "true") == "true",
}
config.action_mailer.default_url_options = {

View File

@ -59,12 +59,12 @@ Rails.application.configure do
config.action_mailer.smtp_settings = {
address: ENV['SMTP_ADDRESS'],
port: 587,
port: ENV.fetch('SMTP_PORT', "587").to_i,
domain: ENV['SMTP_DOMAIN'],
user_name: ENV['SMTP_USERNAME'],
password: ENV['SMTP_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true,
enable_starttls_auto: ENV.fetch("SMTP_STARTTLS", "true") == "true",
}
config.action_mailer.default_url_options = {

View File

@ -1,5 +1,7 @@
DATABASE_URL=postgres://username:password@example.org/dbname
SMTP_ADDRESS=smtp.example.org
SMTP_PORT=587
SMTP_STARTTLS=true
SMTP_DOMAIN=example.org
SMTP_USERNAME=username
SMTP_PASSWORD=password