Add email blacklist check to prevent sending to specific addresses
- Added a static blacklist in `sendEmailMailerSend` to skip sending emails to blacklisted addresses. - Implemented a return condition if the recipient email matches the blacklist.
This commit is contained in:
@@ -120,6 +120,14 @@ class email implements email_i
|
||||
*/
|
||||
private function sendEmailMailerSend(string $to, string $recipient_name, string $subject, string $message, string $html = null, string $references = null, array $attachments = []): void
|
||||
{
|
||||
// Check if the email is blacklisted
|
||||
$blacklisted_emails = [
|
||||
'invoice.dk@freja.com', // TODO: Make this dynamic.
|
||||
];
|
||||
// If the email is blacklisted, return without sending the email
|
||||
if (in_array($to, $blacklisted_emails)) {
|
||||
return;
|
||||
}
|
||||
// Send POST request to email service
|
||||
$mailersend = new MailerSend(['api_key' => $this->config->mailersend_api_key->getVariableValue()]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user