mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for mailers when attachments are too large
This commit is contained in:
parent
78a69329d4
commit
fa1e52b4ca
@ -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]);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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');
|
||||
});
|
||||
|
@ -64,6 +64,7 @@ class EmailMailer implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
throw new \Exception("poopies");
|
||||
|
||||
MultiDB::setDb($this->email_service->company->db);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user