mailable = $mailable; $this->company = $company; $this->to_user = $to_user; $this->sending_method = $sending_method; if($to_user instanceof ClientContact) $this->settings = $to_user->client->getMergedSettings(); else $this->settings = $this->company->settings; } public function handle() { MultiDB::setDb($this->company->db); //if we need to set an email driver do it now $this->setMailDriver(); //send email Mail::to($this->to_user->email) ->send($this->mailable); //catch errors if (count(Mail::failures()) > 0) { $this->logMailError(Mail::failures(), $this->to_user); } } }