body = $mail->body; $this->recipient = $mail->recipient; $this->recipient_type = $mail->recipient_type; $this->subject = $mail->subject; $this->connection = 'database'; } /** * Execute the job. * Utilized by using SendEveMailJob::dispatch($mail); * The model is passed into the dispatch function, then added to the queue * for processing. * * @return void */ public function handle() { //Retrieve the token for main character to send mails from $token = EsiToken::where(['character_id'=> 93738489])->get(); //Create the ESI authentication container $config = config('esi'); $authentication = new EsiAuthentication([ 'client_id' => $config['client_id'], 'secret' => $config['secret'], 'refresh_token' => $token[0]->refresh_token, ]); //Setup the Eseye class $esi = new Eseye($authentication); //Attemp to send the mail try { $esi->setBody([ 'approved_cost' => 0, 'body' => $this->body, 'recipients' => [[ 'recipient_id' => (int)$this->recipient, 'recipient_type' => $this->recipient_type, ]], 'subject' => $this->subject, ])->invoke('post', '/characters/{character_id}/mail/', [ 'character_id'=> 93738489, ]); } catch(RequestFailedException $e) { return null; } $this->delete(); } /** * The job failed to process. * * @param Exception $exception * @return void */ public function failed($exception) { dd($exception); } }