HaveEsiScope($sender, 'esi-mail.send_mail.v1')) { Log::critical('Could not find correct scope for the token for the mailer.'); return null; } //Retrieve token from from the database for the sender $token = $esiHelper->GetRefreshToken($sender); //Create the ESI authentication container $esi = $esiHelper->SetupEsiAuthentication($token); //Set caching to null $configuration = Configuration::getInstance(); $configuration->cache = NullCache::class; //Attempt to send the mail try { $esi->setBody([ 'approved_cost' => 100, 'body' => $this->body, 'recipients' => [[ 'recipient_id' => $this->recipient, 'recipient_type' => $this->recipient_type, ]], 'subject' => $this->subject, ])->invoke('post', '/characters/{character_id}/mail/', [ 'character_id'=> $this->sender, ]); } catch(RequestFailedException $e) { Log::warning($e); return null; } } }