Refactor mailer options usage
This commit is contained in:
parent
c4c2d16342
commit
339462f320
@ -1,4 +1,5 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default Rails.application.config.action_mailer.default_options
|
||||
layout 'mailer'
|
||||
|
||||
private
|
||||
@ -19,7 +20,7 @@ class ApplicationMailer < ActionMailer::Base
|
||||
end
|
||||
|
||||
def from_address
|
||||
ENV.fetch('SMTP_FROM_ADDRESS', 'accounts@localhost')
|
||||
self.class.default[:from]
|
||||
end
|
||||
|
||||
def from_domain
|
||||
|
@ -57,16 +57,22 @@ Rails.application.configure do
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
|
||||
config.action_mailer.default_options = {
|
||||
from: "accounts@localhost"
|
||||
}
|
||||
|
||||
# Don't actually send emails, cache them for viewing via letter opener
|
||||
config.action_mailer.delivery_method = :letter_opener
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
|
||||
# Base URL to be used by email template link helpers
|
||||
config.action_mailer.default_url_options = { host: "localhost:3000", protocol: "http" }
|
||||
config.action_mailer.default_url_options = {
|
||||
host: "localhost:3000",
|
||||
protocol: "http"
|
||||
}
|
||||
|
||||
config.action_mailer.default_options = {
|
||||
from: "accounts@localhost",
|
||||
message_id: -> { "<#{Mail.random_tag}@localhost>" },
|
||||
}
|
||||
|
||||
# Allow requests from any IP
|
||||
config.web_console.permissions = '0.0.0.0/0'
|
||||
|
@ -63,7 +63,7 @@ Rails.application.configure do
|
||||
outgoing_email_domain = Mail::Address.new(outgoing_email_address).domain
|
||||
|
||||
config.action_mailer.default_url_options = {
|
||||
host: ENV['AKKOUNTS_DOMAIN'],
|
||||
host: ENV.fetch('AKKOUNTS_DOMAIN'),
|
||||
protocol: "https",
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,12 @@ Rails.application.configure do
|
||||
|
||||
config.action_mailer.default_url_options = {
|
||||
host: "accounts.kosmos.org",
|
||||
protocol: "https",
|
||||
from: "accounts@kosmos.org"
|
||||
protocol: "https"
|
||||
}
|
||||
|
||||
config.action_mailer.default_options = {
|
||||
from: "accounts@kosmos.org",
|
||||
message_id: -> { "<#{Mail.random_tag}@kosmos.org>" },
|
||||
}
|
||||
|
||||
config.active_job.queue_adapter = :test
|
||||
|
Loading…
x
Reference in New Issue
Block a user