1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Improve error if email fails to send

This commit is contained in:
Hillel Coren 2016-11-27 16:58:32 +02:00
parent b03b1ec6cd
commit a99079da95
2 changed files with 11 additions and 2 deletions

View File

@ -102,7 +102,15 @@ class Mailer
private function handleFailure($exception)
{
if (isset($_ENV['POSTMARK_API_TOKEN']) && method_exists($exception, 'getResponse')) {
$response = $exception->getResponse()->getBody()->getContents();
$response = $exception->getResponse();
if (! $response) {
$error = trans('texts.postmark_error', ['link' => link_to('https://status.postmarkapp.com/')]);
Utils::logError($error);
return $error;
}
$response = $response->getBody()->getContents();
$response = json_decode($response);
$emailError = nl2br($response->Message);
} else {

View File

@ -2227,7 +2227,8 @@ $LANG = array(
'entity_state' => 'State',
'payment_status_name' => 'Status',
'client_created_at' => 'Date Created',
'json_import_help' => 'We recommend importing into an empty account.'
'json_import_help' => 'We recommend importing into an empty account.',
'postmark_error' => 'There was a problem sending the email through Postmark: :link',
);