to = $to; $this->code = $code; $this->title = $title ?? '邮箱验证码'; } public function middleware() { return [new RateLimited]; } /** * Execute the job. */ public function handle(): void { Mail::to($this->to) ->send(new SendEmail($this->code, $this->title)); } public function failed(Throwable $exception) { Mail::to($this->to) ->send(new SendEmail($this->code, $this->title)); } }