sendmail
This commit is contained in:
@@ -62,10 +62,21 @@ class SendMail extends Command
|
||||
//Add the entry into the jobs table saying the job is starting
|
||||
$task->SetStartStatus();
|
||||
|
||||
//Retrieve the token for main character to send mails from
|
||||
$token = EsiToken::where(['character_id' => 93738489])->get();
|
||||
|
||||
//Set the date
|
||||
$date = Carbon::now()->subMonth();
|
||||
//Set the mail helper variable
|
||||
$mHelper = new Mail();
|
||||
//Create a new esi container and authentication
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
'refresh_token' => $token->refresh_token,
|
||||
]);
|
||||
$esi = new Eseye($authentication);
|
||||
|
||||
//Get the full list of bills to send out
|
||||
$bills = MonthlyMarketTax::where(['month' => $date->month, 'year' => $date->year])->get();
|
||||
@@ -78,6 +89,21 @@ class SendMail extends Command
|
||||
'<br>Market Taxes Owed: ' .
|
||||
$bill->tax_owed .
|
||||
'<br>Please remit to Spatial Forces';
|
||||
try {
|
||||
$esi->setBody([
|
||||
'body' => $body,
|
||||
'recipients' => [
|
||||
'recipient_id' => $recipient,
|
||||
'recipient_type' => 'character',
|
||||
],
|
||||
'subject' => $subject,
|
||||
])->invoke('post', '/characters/{character_id}/mail/', [
|
||||
'character_id'=> 93738489,
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
//
|
||||
}
|
||||
|
||||
$error = $mHelper->SendMail($bill->character_id, $bill->tax_owed, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user