mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 11:14:37 -04:00
error handling for mail
This commit is contained in:
parent
5cd2ae0dbe
commit
ef9043db44
@ -12,8 +12,10 @@
|
|||||||
namespace App\Jobs\Mail;
|
namespace App\Jobs\Mail;
|
||||||
|
|
||||||
use App\DataMapper\Analytics\EmailFailure;
|
use App\DataMapper\Analytics\EmailFailure;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Libraries\Google\Google;
|
use App\Libraries\Google\Google;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\SystemLog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Providers\MailServiceProvider;
|
use App\Providers\MailServiceProvider;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
@ -75,7 +77,7 @@ class BaseMailerJob implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function logMailError($errors, $recipient_object)
|
public function logMailError($errors, $recipient_object)
|
||||||
{info(print_r($errors,1));
|
{
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatch(
|
||||||
$errors,
|
$errors,
|
||||||
SystemLog::CATEGORY_MAIL,
|
SystemLog::CATEGORY_MAIL,
|
||||||
|
@ -94,14 +94,17 @@ class EmailPayment extends BaseMailerJob implements ShouldQueue
|
|||||||
}catch(\Exception $e) {
|
}catch(\Exception $e) {
|
||||||
|
|
||||||
info("mailing failed with message " . $e->getMessage());
|
info("mailing failed with message " . $e->getMessage());
|
||||||
|
event(new PaymentWasEmailedAndFailed($this->payment, $this->company, Mail::failures(), Ninja::eventVars()));
|
||||||
|
return $this->logMailError($e->getMessage(), $this->payment->client);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(Mail::failures()) > 0) {
|
// if (count(Mail::failures()) > 0) {
|
||||||
event(new PaymentWasEmailedAndFailed($this->payment, Mail::failures(), Ninja::eventVars()));
|
// info("logging mail failures");
|
||||||
|
// info(print_r(Mail::failures(),1));
|
||||||
|
|
||||||
return $this->logMailError(Mail::failures());
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
event(new PaymentWasEmailed($this->payment, $this->payment->company, Ninja::eventVars()));
|
event(new PaymentWasEmailed($this->payment, $this->payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user