mailer = new Mailer($transport); } public function send(Account $account, Message $message): bool { try { if (!$account->email) { throw new ChannelFailException("用户邮箱地址不存在"); } $email = (new Email()) ->from(new Address(config("mailer.default.username"), config("mailer.default.name"))) ->to($account->email) ->subject($message->title) ->html($message->content); $this->mailer->send($email); return true; } catch (\Exception $exception) { throw new ChannelFailException($exception->getMessage()); } } public function getName(): string { return "email"; } }