From 07b58b42009e85758093e587a984988e6e6e1f58 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 4 Mar 2023 22:26:09 +0100 Subject: [PATCH] Catch common mail errors --- app/Jobs/MailError.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 688a2ba15f..4d3cedadee 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -91,6 +91,15 @@ class MailError extends Job implements ShouldQueue } ); } catch (Exception $e) { // intentional generic exception + $message = $e->getMessage(); + if (str_contains($message, 'Bcc')) { + Log::warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.'); + return; + } + if (str_contains($message, 'RFC 2822')) { + Log::warning('[RFC] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.'); + return; + } throw new FireflyException($e->getMessage(), 0, $e); } }