Catch common mail errors

This commit is contained in:
James Cole 2023-03-04 22:26:09 +01:00
parent 8807f04599
commit 07b58b4200
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -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);
}
}