Merge pull request #7945 from betagouv/improve_do_list_header
fix(dolist): réduit le nombre de 'Message-Name' possible chez dolist
This commit is contained in:
commit
0dcd755fd0
2 changed files with 10 additions and 1 deletions
|
@ -3,6 +3,8 @@ class ApplicationMailer < ActionMailer::Base
|
|||
default from: "#{APPLICATION_NAME} <#{CONTACT_EMAIL}>"
|
||||
layout 'mailer'
|
||||
|
||||
before_action :add_dolist_header
|
||||
|
||||
# Don’t retry to send a message if the server rejects the recipient address
|
||||
rescue_from Net::SMTPSyntaxError do |_error|
|
||||
message.perform_deliveries = false
|
||||
|
@ -28,4 +30,12 @@ class ApplicationMailer < ActionMailer::Base
|
|||
Sentry.capture_exception(e, extra: { procedure_id: procedure.id })
|
||||
nil
|
||||
end
|
||||
|
||||
# mandatory for dolist
|
||||
# used for tracking in Dolist UI
|
||||
# the delivery_method is yet unknown (:balancer)
|
||||
# so we add the dolist header for everyone
|
||||
def add_dolist_header
|
||||
headers['X-Dolist-Message-Name'] = action_name
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,6 @@ ActiveSupport.on_load(:action_mailer) do
|
|||
mail.sender(ENV['DOLIST_NO_REPLY_EMAIL'])
|
||||
mail['X-ACCOUNT-ID'] = Rails.application.secrets.dolist[:account_id]
|
||||
|
||||
mail['X-Dolist-Message-Name'] = mail.subject # for tracking in Dolist UI
|
||||
mail['X-Dolist-Sending-Type'] = 'TransactionalService' # send even if the target is not active
|
||||
|
||||
super(mail)
|
||||
|
|
Loading…
Reference in a new issue