diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 306213cb3079..a15c511ba95e 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -176,21 +176,25 @@ class NinjaMailerJob implements ShouldQueue * this merges a text string with a json object * need to harvest the ->Message property using the following */ - if($e instanceof ClientException) + if(stripos($e->getMessage(), 'code 406') || stripos($e->getMessage(), 'code 300')) { - $response = $e->getResponse(); - $message_body = json_decode($response->getBody()->getContents()); - - if($message_body && property_exists($message_body, 'Message')){ - $message = $message_body->Message; - } - - /*Do not retry if this is a postmark specific issue such as invalid recipient. */ + $message = "Either Attachment too large, or recipient has been suppressed."; + $this->fail(); $this->cleanUpMailers(); + return; + // $response = $e->getResponse(); + // $message_body = json_decode($response->getBody()->getContents()); + + // if($message_body && property_exists($message_body, 'Message')){ + // $message = $message_body->Message; + // } + + /*Do not retry if this is a postmark specific issue such as invalid recipient. */ + } //only report once, not on all tries @@ -647,8 +651,9 @@ class NinjaMailerJob implements ShouldQueue public function failed($exception = null) { - if($exception) - nlog($exception->getMessage()); + + config(['queue.failed.driver' => null]); + } } \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index d0752dd5ce8c..a0c93ab683fb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -24,7 +24,6 @@ use Illuminate\Queue\Events\JobProcessing; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Blade; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\ParallelTesting; use Illuminate\Support\Facades\Queue; @@ -52,6 +51,11 @@ class AppServiceProvider extends ServiceProvider // ); // }); + // Model::preventLazyLoading( + // !$this->app->isProduction() + // ); + + /* Defines the name used in polymorphic tables */ Relation::morphMap([ 'invoices' => Invoice::class, 'proposals' => Proposal::class, @@ -61,6 +65,7 @@ class AppServiceProvider extends ServiceProvider return config('ninja.environment') === $environment; }); + /* Sets default varchar length */ Schema::defaultStringLength(191); /* Handles setting the correct database with livewire classes */ @@ -75,11 +80,10 @@ class AppServiceProvider extends ServiceProvider App::forgetInstance('truthsource'); }); + /* Always init a new instance everytime the container boots */ app()->instance(TruthSource::class, new TruthSource()); - // Model::preventLazyLoading( - // !$this->app->isProduction() - // ); + /* Extension for custom mailers */ Mail::extend('gmail', function () { return new GmailTransport(); @@ -113,6 +117,10 @@ class AppServiceProvider extends ServiceProvider return $this; }); + /* Extension for custom mailers */ + + + /* Convenience helper for testing s*/ ParallelTesting::setUpTestDatabase(function ($database, $token) { Artisan::call('db:seed'); }); diff --git a/app/Services/Email/EmailMailer.php b/app/Services/Email/EmailMailer.php index 6d885db2db28..ab81f1fbec46 100644 --- a/app/Services/Email/EmailMailer.php +++ b/app/Services/Email/EmailMailer.php @@ -64,6 +64,7 @@ class EmailMailer implements ShouldQueue public function handle(): void { +throw new \Exception("poopies"); MultiDB::setDb($this->email_service->company->db);