diff --git a/Classes/Service/ApiService.php b/Classes/Service/ApiService.php index aaef0f1..b6eac34 100644 --- a/Classes/Service/ApiService.php +++ b/Classes/Service/ApiService.php @@ -257,7 +257,14 @@ public function sendSubscribeMail(string $email, ?int $formId = null, ?int $grou ] ); } catch (GuzzleException $ex) { - $this->logger->alert('cannot send subscribe email: ' . $ex->getMessage(), [$ex]); + // Because CleverReach sends a generic 403 error if the email address is deemed to be spam (which happens + // frequently), and there is no way to distinguish this from any other reason an email address is forbidden, + // we log this as a warning instead of an error. + if ($ex instanceof BadResponseException && (int)$ex->getCode() === 403) { + $this->logger->warning('Subscription forbidden: ' . $ex->getMessage(), [$ex]); + } else { + $this->logger->error('Cannot send subscribe email: ' . $ex->getMessage(), [$ex]); + } } }