diff --git a/.env.production.sample b/.env.production.sample index 6555cb12a2..0759ed7faf 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -35,6 +35,8 @@ OTP_SECRET= # E-mail configuration # Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers +# If you want to use an SMTP server without authentication (e.g local Postfix relay) +# then set SMTP_AUTH_METHOD to 'none' and leave SMTP_LOGIN and SMTP_PASSWORD blank SMTP_SERVER=smtp.mailgun.org SMTP_PORT=587 SMTP_LOGIN= diff --git a/config/environments/production.rb b/config/environments/production.rb index 80021287a5..a4cdb27323 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -100,8 +100,10 @@ Rails.application.configure do :address => ENV['SMTP_SERVER'], :user_name => ENV['SMTP_LOGIN'], :password => ENV['SMTP_PASSWORD'], + :domain => ENV['SMTP_DOMAIN'] || ENV['LOCAL_DOMAIN'], - :authentication => ENV['SMTP_AUTH_METHOD'] || :plain, + :authentication => ENV['SMTP_AUTH_METHOD'] == 'none' ? nil : ENV['SMTP_AUTH_METHOD'] || :plain, + :openssl_verify_mode => ENV['SMTP_OPENSSL_VERIFY_MODE'], :enable_starttls_auto => ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true, }