Merge pull request #10357 from demarches-simplifiees/fix_dolist_gouv_sender
Tech: pour le prestataire de mail dolist, choisit le bon sender_id en fonction du domaine utilisé (migration gouv.fr)
This commit is contained in:
commit
c52ff5cdeb
3 changed files with 9 additions and 4 deletions
|
@ -190,9 +190,11 @@ module Dolist
|
|||
format(base, account_id: account_id)
|
||||
end
|
||||
|
||||
def sender_id
|
||||
Rails.cache.fetch("dolist_api_sender_id", expires_in: 1.hour) do
|
||||
senders.dig("ItemList", 0, "Sender", "ID")
|
||||
def sender_id(domain)
|
||||
if domain == "demarches.gouv.fr"
|
||||
Rails.application.secrets.dolist[:gouv_sender_id]
|
||||
else
|
||||
Rails.application.secrets.dolist[:default_sender_id]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -267,7 +269,7 @@ module Dolist
|
|||
"Message": {
|
||||
"Name": mail['X-Dolist-Message-Name'].value,
|
||||
"Subject": mail.subject,
|
||||
"SenderID": sender_id,
|
||||
"SenderID": sender_id(mail.from_address.domain),
|
||||
"ForceHttp": false, # ForceHttp : force le tracking http non sécurisé (True/False).
|
||||
"Format": "html",
|
||||
"DisableOpenTracking": true, # DisableOpenTracking : désactivation du tracking d'ouverture (True/False).
|
||||
|
|
|
@ -137,6 +137,7 @@ MATOMO_IFRAME_URL="https://matomo.example.org/index.php?module=CoreAdminHome&act
|
|||
# DOLIST_ACCOUNT_ID=""
|
||||
# DOLIST_NO_REPLY_EMAIL=""
|
||||
# DOLIST_API_KEY=""
|
||||
# DOLIST_DEFAULT_SENDER_ID=""
|
||||
|
||||
# SMTP Provider: SIB (Brevo)
|
||||
# SENDINBLUE_SMTP_ADDRESS=""
|
||||
|
|
|
@ -32,6 +32,8 @@ defaults: &defaults
|
|||
password: <%= ENV['DOLIST_PASSWORD'] %>
|
||||
account_id: <%= ENV['DOLIST_ACCOUNT_ID'] %>
|
||||
api_key: <%= ENV['DOLIST_API_KEY'] %>
|
||||
default_sender_id: <%= ENV['DOLIST_DEFAULT_SENDER_ID'] || 1 %>
|
||||
gouv_sender_id: <%= ENV['DOLIST_GOUV_SENDER_ID'] || 1 %>
|
||||
api_entreprise:
|
||||
key: <%= ENV['API_ENTREPRISE_KEY'] %>
|
||||
mailtrap:
|
||||
|
|
Loading…
Reference in a new issue