How does TP5.1 do mailbox verification?

for example, I want to verify that this email is legal. How do I want to verify it with TP"s own verification rules? I think the manual defines a User class We define a\ app\ index\ validate\ User validator class for User validation. is it so troublesome for the TP framework to verify mailbox usernames or something? Where should this validator class be written? Is it in the same directory as the controller?

<?php
namespace app\index\controller;
use think\Controller;
use think\facade\Request;
use think\response;
use think\View;
use think\Validate;
class Register extends Controller
{
    public function regcheck(){
        $data=input("email");
        
    }
}
?>
Mar.04,2021

for individual verification, you can call statically

// 
use think\facade\Validate;

Validate::isEmail('thinkphp@qq.com'); // true

if there are many things to verify, it is recommended to use validator
validator class can customize the directory, it is recommended to put it in the \ app\ index\ validate directory.

Validator class

namespace app\index\validate;

use think\Validate;

class User extends Validate
{
    protected $rule =   [
        'name'  => 'require|max:25',
        'email' => 'email',    
    ];
    
    protected $message  =   [
        'name.require' => '',
        'name.max'     => '25',
        'email'        => '',    
    ];
    
}

used in the controller:

namespace app\index\controller;

use think\Controller;

class Index extends Controller
{
    public function index()
    {
        $data = [
            'name'  => 'thinkphp',
            'email' => 'thinkphp@qq.com',
        ];

        $validate = new \app\index\validate\User;

        if (!$validate->check($data)) {
            dump($validate->getError());
        }
    }
}
Menu