2022-05-02 17:30:37 +02:00
|
|
|
if ENV.key?('SENDINBLUE_BALANCING_VALUE')
|
2022-01-26 11:33:12 +01:00
|
|
|
require 'sib-api-v3-sdk'
|
2020-10-06 20:24:08 +02:00
|
|
|
|
2022-01-26 11:33:12 +01:00
|
|
|
ActiveSupport.on_load(:action_mailer) do
|
|
|
|
module Sendinblue
|
|
|
|
class SMTP < ::Mail::SMTP; end
|
|
|
|
end
|
|
|
|
|
|
|
|
ActionMailer::Base.add_delivery_method :sendinblue, Sendinblue::SMTP
|
|
|
|
ActionMailer::Base.sendinblue_settings = {
|
|
|
|
user_name: Rails.application.secrets.sendinblue[:username],
|
|
|
|
password: Rails.application.secrets.sendinblue[:smtp_key],
|
2023-09-06 11:24:23 +02:00
|
|
|
address: ENV.fetch("SENDINBLUE_SMTP_ADDRESS", "smtp-relay.brevo.com"),
|
2023-07-17 15:51:15 +02:00
|
|
|
domain: 'smtp-relay.brevo.com',
|
2023-09-06 11:24:23 +02:00
|
|
|
port: ENV.fetch("SENDINBLUE_SMTP_PORT", "587"),
|
2022-01-26 11:33:12 +01:00
|
|
|
authentication: :cram_md5
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
SibApiV3Sdk.configure do |config|
|
|
|
|
config.api_key['api-key'] = Rails.application.secrets.sendinblue[:api_v3_key]
|
|
|
|
end
|
2020-10-06 20:24:08 +02:00
|
|
|
end
|