config: fix DynamicSmtpSettingsInterceptor warning again
This warning re-appeared when running mailer tests: ``` DISABLE_SPRING=1 bin/rspec spec/mailers/administration_mailer_spec.rb ``` It is now fixed properly, in a way recommanded by the documentation.
This commit is contained in:
parent
abb8b04208
commit
b0735aafe0
2 changed files with 12 additions and 1 deletions
22
lib/action_mailer/dynamic_smtp_settings_interceptor.rb
Normal file
22
lib/action_mailer/dynamic_smtp_settings_interceptor.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Note: this class is instanciated when being added as an interceptor
|
||||
# during the app initialization.
|
||||
#
|
||||
# If you edit this file in development env, you will need to restart
|
||||
# the app to see the changes.
|
||||
|
||||
class DynamicSmtpSettingsInterceptor
|
||||
def self.delivering_email(message)
|
||||
if ENV['SENDINBLUE_BALANCING'] == 'enabled'
|
||||
if rand(0..99) < ENV['SENDINBLUE_BALANCING_VALUE'].to_i
|
||||
message.delivery_method.settings = {
|
||||
user_name: ENV['SENDINBLUE_USER_NAME'],
|
||||
password: ENV['SENDINBLUE_SMTP_KEY'],
|
||||
address: 'smtp-relay.sendinblue.com',
|
||||
domain: 'smtp-relay.sendinblue.com',
|
||||
port: '587',
|
||||
authentication: :cram_md5
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue