Config email send

master
aeris 2021-01-01 18:06:32 +01:00
parent f071dea0cd
commit a192c1bc09
4 changed files with 27 additions and 2 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
.env.local
.env.*.local
# Ignore bundler config.
/.bundle

View File

@ -32,9 +32,9 @@ Rails.application.configure do
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
config.action_mailer.perform_deliveries = true
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

View File

@ -0,0 +1,8 @@
if Rails.env.development? && ENV['DISABLE_MAILHOG'].nil?
Rails.application.configure do
config.action_mailer.smtp_settings = {
address: ENV.fetch('MAILHOG_HOST', 'localhost'),
port: ENV.fetch('MAILHOG_PORT', 1025).to_i
}
end
end

View File

@ -0,0 +1,15 @@
api_key = ENV['SENDGRID_API_KEY']
if api_key
domain = ENV['SENDGRID_DOMAIN']
Rails.application.configure do
config.action_mailer.smtp_settings = {
user_name: :apikey,
password: api_key,
domain: domain,
address: 'smtp.sendgrid.net',
port: 587,
authentication: :plain,
enable_starttls_auto: true
}
end
end