diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 2f90b46ac115..c128088de30d 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -226,10 +226,10 @@ class NinjaMailerJob implements ShouldQueue if(!$user->oauth_user_token) { $this->company->account->gmailCredentialNotification(); - return; + $this->nmo->settings->email_sending_method = 'default'; + return $this->setMailDriver(); } - /* * Now that our token is refreshed and valid we can boot the * mail driver at runtime and also set the token which will persist @@ -238,6 +238,12 @@ class NinjaMailerJob implements ShouldQueue $token = $user->oauth_user_token->access_token; + if(!$token) { + $this->company->account->gmailCredentialNotification(); + $this->nmo->settings->email_sending_method = 'default'; + return $this->setMailDriver(); + } + $this->nmo ->mailable ->from($user->email, $user->name())