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;
|
||||
|
||||
use App\Http\Requests\Admin\ConfigSave;
|
||||
use App\Jobs\SendEmailJob;
|
||||
use App\Services\TelegramService;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Utils\Dict;
|
||||
@ -35,20 +36,19 @@ class ConfigController extends Controller
|
||||
|
||||
public function testSendMail(Request $request)
|
||||
{
|
||||
$email = $request->session()->get('email');
|
||||
$subject = 'This is v2board test email';
|
||||
try {
|
||||
Mail::raw(
|
||||
'This is v2board test email',
|
||||
function ($message) use ($email, $subject) {
|
||||
$message->to($email)->subject($subject);
|
||||
}
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
abort(500, $e->getMessage());
|
||||
}
|
||||
$obj = new SendEmailJob([
|
||||
'email' => $request->session()->get('email'),
|
||||
'subject' => 'This is v2board test email',
|
||||
'template_name' => 'notify',
|
||||
'template_value' => [
|
||||
'name' => config('v2board.app_name', 'V2Board'),
|
||||
'content' => 'This is v2board test email',
|
||||
'url' => config('v2board.app_url')
|
||||
]
|
||||
]);
|
||||
return response([
|
||||
'data' => true
|
||||
'data' => true,
|
||||
'log' => $obj->handle()
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,15 @@ class SendEmailJob implements ShouldQueue
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
|
||||
MailLog::create([
|
||||
$log = [
|
||||
'email' => $params['email'],
|
||||
'subject' => $params['subject'],
|
||||
'template_name' => $params['template_name'],
|
||||
'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