847abca122
Move everything to initializers, and replace the email settings interceptor by a BalancerDeliveryMethod. It has the advantage that it can be configured entirely from the `config/environment.rb` file, without an extra file to look at.
17 lines
533 B
Ruby
17 lines
533 B
Ruby
if ENV.fetch('MAILTRAP_ENABLED') == 'enabled'
|
|
ActiveSupport.on_load(:action_mailer) do
|
|
module Mailtrap
|
|
class SMTP < ::Mail::SMTP; end
|
|
end
|
|
|
|
ActionMailer::Base.add_delivery_method :mailtrap, Mailtrap::SMTP
|
|
ActionMailer::Base.mailtrap_settings = {
|
|
user_name: Rails.application.secrets.mailtrap[:username],
|
|
password: Rails.application.secrets.mailtrap[:password],
|
|
address: 'smtp.mailtrap.io',
|
|
domain: 'smtp.mailtrap.io',
|
|
port: '2525',
|
|
authentication: :cram_md5
|
|
}
|
|
end
|
|
end
|