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

Log email error for self host installs

This commit is contained in:
Hillel Coren 2016-11-06 15:21:09 +02:00
parent 26f4a84897
commit a76e9ae437

View File

@ -1,5 +1,6 @@
<?php namespace App\Ninja\Mailers;
use Utils;
use Exception;
use Mail;
use App\Models\Invoice;
@ -29,7 +30,7 @@ class Mailer
if (stristr($toEmail, '@example.com')) {
return true;
}
if (isset($_ENV['POSTMARK_API_TOKEN'])) {
$views = 'emails.'.$view.'_html';
} else {
@ -55,7 +56,7 @@ class Mailer
if (!empty($data['pdfString']) && !empty($data['pdfFileName'])) {
$message->attachData($data['pdfString'], $data['pdfFileName']);
}
// Attach documents to the email
if(!empty($data['documents'])){
foreach($data['documents'] as $document){
@ -90,7 +91,7 @@ class Mailer
$invoice->markInvitationSent($invitation, $messageId);
}
return true;
}
@ -107,11 +108,13 @@ class Mailer
} else {
$emailError = $exception->getMessage();
}
if (isset($data['invitation'])) {
$invitation = $data['invitation'];
$invitation->email_error = $emailError;
$invitation->save();
} elseif ( ! Utils::isNinja()) {
Utils::logError(Utils::getErrorString($exception));
}
return $emailError;