ruoyi-vue-plus-推送功能
# 推送功能
服务器处理产生的信息 , 让客户机收到这些信息需要到推送功能 , 如 : 手机短信&电子邮箱 验证码以及监控等场景
参考文档
- SMS4J(短信推送)官方文档 : http://www.sms4j.com (opens new window)
- ruoyi-vue-plus短信推送应用文档 : https://plus-doc.dromara.org (opens new window)
- ruoyi-vue-plus邮箱推送应用文档 : https://plus-doc.dromara.org (opens new window)
# 邮箱推送
Hutool工具框架实现邮件推送功能
Hutool官方文档 : https://doc.hutool.cn (opens new window)
核心配置 :
- 服务器(host)
- 服务端口(port)
- 发送方(from)
- 用户名(user)
- 密码(pass)
自定义邮件服务器需要自行装配Bean
点击展开
@Configuration
public class MailConfig {
@Bean
@ConditionalOnProperty(value = "mail.enabled", havingValue = "true")
public MailAccount mailAccount(MailProperties mailProperties) {
MailAccount account = new MailAccount();
account.setHost(mailProperties.getHost());
account.setPort(mailProperties.getPort());
account.setAuth(mailProperties.getAuth());
account.setFrom(mailProperties.getFrom());
account.setUser(mailProperties.getUser());
account.setPass(mailProperties.getPass());
account.setSocketFactoryPort(mailProperties.getPort());
account.setStarttlsEnable(mailProperties.getStarttlsEnable());
account.setSslEnable(mailProperties.getSslEnable());
account.setTimeout(mailProperties.getTimeout());
account.setConnectionTimeout(mailProperties.getConnectionTimeout());
return account;
}
}
# 短信推送
采用 SMS4j框架 实现 , 支持多个厂商短信服务
SMS4J(短信推送)官方文档 : http://www.sms4j.com (opens new window)
核心配置 :
- 阿里云key
accessKeyId
、accessKeySecret
- 阿里云短信签名(短信标题)
- 模板ID(创建后复制code)
提示
ruoyi-vue-plus框架并未对SMS4J进行逻辑封装