/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$params = $this->params;
$localization = \Mcamara\LaravelLocalization\LaravelLocalization::class;
if (class_exists($localization)) {
\LaravelLocalization::setLocale($this->locale);
}
app()->setLocale($this->locale);
if ($this->type == 'Normal') {
// Text send
Mail::raw($params['html'], function ($message) use($params) {
if ($params['attach']) {
$message->attach($params['attach']);
}
$message->to($params['to'])->from(env('MAIL_USERNAME'), $params['fromName'])->subject($params['subject']);
});
} elseif ($this->type == 'Template') {
// Template send
Mail::send($params['templateInvokeName'], $params['xsmtpapi'], function ($message) use($params) {
if ($params['attach']) {
$message->attach($params['attach']);
}
$message->to($params['to'])->from(env('MAIL_USERNAME'), $params['fromName'])->subject($params['subject']);
});
}
$fileDir = $this->getSwiftmailLogDir();
$this->logInfo('[' . Carbon::now($this->local)->format('Y-m-d H:i:s') . ']' . json_encode($params, JSON_UNESCAPED_UNICODE) . chr(10), $fileDir);
}