mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Log email error for self host installs
This commit is contained in:
parent
26f4a84897
commit
a76e9ae437
@ -1,5 +1,6 @@
|
|||||||
<?php namespace App\Ninja\Mailers;
|
<?php namespace App\Ninja\Mailers;
|
||||||
|
|
||||||
|
use Utils;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Mail;
|
use Mail;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
@ -29,7 +30,7 @@ class Mailer
|
|||||||
if (stristr($toEmail, '@example.com')) {
|
if (stristr($toEmail, '@example.com')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_ENV['POSTMARK_API_TOKEN'])) {
|
if (isset($_ENV['POSTMARK_API_TOKEN'])) {
|
||||||
$views = 'emails.'.$view.'_html';
|
$views = 'emails.'.$view.'_html';
|
||||||
} else {
|
} else {
|
||||||
@ -55,7 +56,7 @@ class Mailer
|
|||||||
if (!empty($data['pdfString']) && !empty($data['pdfFileName'])) {
|
if (!empty($data['pdfString']) && !empty($data['pdfFileName'])) {
|
||||||
$message->attachData($data['pdfString'], $data['pdfFileName']);
|
$message->attachData($data['pdfString'], $data['pdfFileName']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach documents to the email
|
// Attach documents to the email
|
||||||
if(!empty($data['documents'])){
|
if(!empty($data['documents'])){
|
||||||
foreach($data['documents'] as $document){
|
foreach($data['documents'] as $document){
|
||||||
@ -90,7 +91,7 @@ class Mailer
|
|||||||
|
|
||||||
$invoice->markInvitationSent($invitation, $messageId);
|
$invoice->markInvitationSent($invitation, $messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,11 +108,13 @@ class Mailer
|
|||||||
} else {
|
} else {
|
||||||
$emailError = $exception->getMessage();
|
$emailError = $exception->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data['invitation'])) {
|
if (isset($data['invitation'])) {
|
||||||
$invitation = $data['invitation'];
|
$invitation = $data['invitation'];
|
||||||
$invitation->email_error = $emailError;
|
$invitation->email_error = $emailError;
|
||||||
$invitation->save();
|
$invitation->save();
|
||||||
|
} elseif ( ! Utils::isNinja()) {
|
||||||
|
Utils::logError(Utils::getErrorString($exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $emailError;
|
return $emailError;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user