此代码删除用户并向他发送消息
public function deleteUser() {
if (auth()) {
$user = auth()->user();
if ($user->delete()) {
Mail::send('vendor.mail.html.message', [], function($m) use($user){
$m->subject('Your account has been deleted');
$m->to($user['email']);
$m->setBody('<p>'.$user['name'].', Hope to see you again</p>', 'text/html');
});
}
}
}
当你切换线路时
Mail::send('vendor.mail.html.message', [], function($m) use($user)
和
Mail::send([], [], function($m) use($user)
消息已发送