类 EmailNoticeService

java.lang.Object
net.sohelp.boot.admin.core.service.notice.EmailNoticeService

@Service public class EmailNoticeService extends Object
邮件消息通知服务类,提供邮件发送、验证码管理等功能。
从以下版本开始:
2023/5/4
作者:
AaronFung
  • 构造器详细资料

    • EmailNoticeService

      public EmailNoticeService()
  • 方法详细资料

    • sendMsg

      @Comment("\u53d1\u9001\u6d88\u606f") public void sendMsg(String toEmail, String msg) throws BusiException
      发送普通消息邮件。
      参数:
      toEmail - 接收邮件的邮箱地址
      msg - 要发送的消息内容(支持HTML格式)
      抛出:
      BusiException - 当邮件发送过程中发生错误时抛出业务异常
    • sendCode

      @Comment("\u53d1\u9001\u9a8c\u8bc1\u7801") public void sendCode(String toEmail, String code) throws BusiException
      发送验证码邮件,并将验证码缓存5分钟以供后续校验使用。
      参数:
      toEmail - 接收验证码的邮箱地址
      code - 要发送的验证码字符串
      抛出:
      BusiException - 当验证码已存在或邮件发送失败时抛出业务异常
    • getCode

      @Comment("\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u9a8c\u7801") public String getCode(String key)
      根据指定键从验证码缓存中获取对应的验证码值。
      参数:
      key - 邮箱地址作为缓存键
      返回:
      String 对应的验证码字符串,若不存在则返回null
    • removeCode

      @Comment("\u5220\u9664Cache") public void removeCode(String key)
      从验证码缓存中移除指定键对应的条目。
      参数:
      key - 需要被删除的缓存键(通常是邮箱地址)