1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00

brevo fixes

This commit is contained in:
paulwer 2024-04-07 14:10:42 +02:00
parent c02a4fb08d
commit 4ac3289819

View File

@ -121,6 +121,8 @@ class ProcessBrevoInboundWebhook implements ShouldQueue
public function handle()
{
$foundOneRecipient = false; // used for spam documentation below
// brevo defines recipients as array, we check all of them, to be sure
foreach ($this->input["Recipients"] as $recipient) {
@ -134,10 +136,11 @@ class ProcessBrevoInboundWebhook implements ShouldQueue
$company = MultiDB::findAndSetDbByExpenseMailbox($recipient);
if (!$company) {
Log::info('[ProcessBrevoInboundWebhook] unknown Expense Mailbox occured while handling an inbound email from brevo: ' . $recipient);
// $this->engine->saveMeta($this->input["From"]["Address"], $recipient, true); // @turbo124 disabled, because recipents contains all recipients, and will likly result in false bans?! => normally important to save this, to protect from spam
continue;
}
$foundOneRecipient = true;
try { // important to save meta if something fails here to prevent spam
$company_brevo_secret = $company->settings?->email_sending_method === 'client_brevo' && $company->settings?->brevo_secret ? $company->settings?->brevo_secret : null;
@ -195,5 +198,11 @@ class ProcessBrevoInboundWebhook implements ShouldQueue
$this->engine->handleExpenseMailbox($inboundMail);
}
// document for spam => mark all recipients as handled emails with unmatched mailbox => otherwise dont do any
if (!$foundOneRecipient)
foreach ($this->input["Recipients"] as $recipient) {
$this->engine->saveMeta($this->input["From"]["Address"], $recipient, true);
}
}
}