1
0
Fork 0

Add file "config/smtp.yml"

This commit is contained in:
Alex Kotov 2018-12-09 08:06:27 +05:00
parent 7ff269aa23
commit 2e54a159f8
No known key found for this signature in database
GPG key ID: 4E831250F47DE154
2 changed files with 21 additions and 9 deletions

View file

@ -2,12 +2,15 @@
# Be sure to restart your server when you modify this file.
ActionMailer::Base.smtp_settings = {
user_name: 'apikey',
password: Rails.application.credentials.sendgrid_api_key,
domain: Rails.application.config.site_domain,
address: 'smtp.sendgrid.net',
port: 587,
authentication: :plain,
enable_starttls_auto: true,
}
Rails.application.config_for(:smtp).try(&:deep_symbolize_keys).try do |config|
ActionMailer::Base.smtp_settings = {
address: config[:address],
port: config[:port]&.to_i,
domain: config[:domain],
user_name: config[:user_name],
password: config[:password],
authentication: config[:authentication]&.to_sym,
enable_starttls_auto: config[:enable_starttls_auto],
openssl_verify_mode: config[:openssl_verify_mode],
}
end

9
config/smtp.yml Normal file
View file

@ -0,0 +1,9 @@
production:
address: smtp.sendgrid.net
port: 587
domain: libertarian-party.com
user_name: apikey
password: <%= Rails.application.credentials.sendgrid_api_key %>
authentication: plain
enable_starttls_auto: true
openssl_verify_mode: peer