mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update: add test send mail
This commit is contained in:
parent
05769ea591
commit
30aec3d8e9
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Http\Requests\Admin\ConfigSave;
|
use App\Http\Requests\Admin\ConfigSave;
|
||||||
|
use App\Jobs\SendEmailJob;
|
||||||
use App\Services\TelegramService;
|
use App\Services\TelegramService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Utils\Dict;
|
use App\Utils\Dict;
|
||||||
@ -35,20 +36,19 @@ class ConfigController extends Controller
|
|||||||
|
|
||||||
public function testSendMail(Request $request)
|
public function testSendMail(Request $request)
|
||||||
{
|
{
|
||||||
$email = $request->session()->get('email');
|
$obj = new SendEmailJob([
|
||||||
$subject = 'This is v2board test email';
|
'email' => $request->session()->get('email'),
|
||||||
try {
|
'subject' => 'This is v2board test email',
|
||||||
Mail::raw(
|
'template_name' => 'notify',
|
||||||
'This is v2board test email',
|
'template_value' => [
|
||||||
function ($message) use ($email, $subject) {
|
'name' => config('v2board.app_name', 'V2Board'),
|
||||||
$message->to($email)->subject($subject);
|
'content' => 'This is v2board test email',
|
||||||
}
|
'url' => config('v2board.app_url')
|
||||||
);
|
]
|
||||||
} catch (\Exception $e) {
|
]);
|
||||||
abort(500, $e->getMessage());
|
|
||||||
}
|
|
||||||
return response([
|
return response([
|
||||||
'data' => true
|
'data' => true,
|
||||||
|
'log' => $obj->handle()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,11 +60,15 @@ class SendEmailJob implements ShouldQueue
|
|||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
MailLog::create([
|
$log = [
|
||||||
'email' => $params['email'],
|
'email' => $params['email'],
|
||||||
'subject' => $params['subject'],
|
'subject' => $params['subject'],
|
||||||
'template_name' => $params['template_name'],
|
'template_name' => $params['template_name'],
|
||||||
'error' => isset($error) ? $error : NULL
|
'error' => isset($error) ? $error : NULL
|
||||||
]);
|
];
|
||||||
|
|
||||||
|
MailLog::create($log);
|
||||||
|
$log['config'] = config('mail');
|
||||||
|
return $log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
public/assets/admin/components.chunk.css
vendored
4
public/assets/admin/components.chunk.css
vendored
File diff suppressed because one or more lines are too long
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user