// 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';
$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);