From 2d8e950efc9ede532b80067231a39b517a928756 Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Mon, 31 Oct 2022 09:49:23 +0000 Subject: [PATCH] Wait #5345 @1 --- inc/ws/Controlleur/class.ws.services.php | 36 +++++++++++++++++------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 2a61d1e4e..b217a49a4 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -1606,22 +1606,32 @@ class wsServices extends cubeFlashGateway // The Fluidbook can pass on a parameter that overrides the default recipient $recipient_code = $_POST['recipient_code'] ?? ''; + $default_bastide_address = 'web@hcm-medical.com'; // Fallback address + destination for all BCC messages + switch(strtolower($recipient_code)) { - case 'guadeloupe': - $email_for_bastide = 'contact2@bastide-guadeloupe.com'; - break; - case 'commercial': + case 'co-guadeloupe': $email_for_bastide = 'commercial@bastide-guadeloupe.com'; break; - case 'martinique': - $email_for_bastide = 'commercial2@bastide-martinique.com'; + case 'gp-guadeloupe': + $email_for_bastide = 'magasin@bastide-guadeloupe.com'; + break; + case 'pro-guadeloupe': + $email_for_bastide = 'contact@bastide-guadeloupe.com'; + break; + case 'gp-martinique': + $email_for_bastide = 'magasin@bastide-martinique.com'; break; - case 'réunion': - case 'reunion': - $email_for_bastide = 'info@bastide.re'; + case 'pro-martinique': + $email_for_bastide = 'adv@bastide-martinique.com'; + break; + case 'gp-réunion': + case 'gp-reunion': + case 'pro-réunion': + case 'pro-reunion': + $email_for_bastide = 'reseau@bastide.re'; break; default: - $email_for_bastide = 'ca@hcm-medical.fr'; + $email_for_bastide = $default_bastide_address; } $return_address = 'postmaster@fluidbook.com'; @@ -1666,6 +1676,12 @@ class wsServices extends cubeFlashGateway $attachment_basename . '.xlsx' ); + // When the recipient isn't the default Bastide address, we add them in as a BCC so they can track the messages + // See: https://redmine.cubedesigners.com/issues/5345#note-36 + if ($email_for_bastide !== $default_bastide_address) { + $mail_to_bastide->addBcc($default_bastide_address); + } + //=== Send the e-mails try { $mail_to_bastide->send($transport); -- 2.39.5