quote_invitation = $quote_invitation; $this->email_builder = $email_builder; } /** * Execute the job. * * * @return void */ public function handle() { Mail::to($this->quote_invitation->contact->email, $this->quote_invitation->contact->present()->name()) ->send( new TemplateEmail( $this->email_builder, $this->quote_invitation->contact->user, $this->quote_invitation->contact->client ) ); if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures()); } $this->quote_invitation->quote->service()->markSent()->save(); } private function logMailError($errors) { SystemLogger::dispatch( $errors, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SEND, SystemLog::TYPE_FAILURE, $this->quote->client ); } }