SSM发送Email
来源:互联网 发布:金投顾软件怎么样 编辑:程序博客网 时间:2024/05/21 13:56
1、需要idea SpringBoot+mybatis
2、在application.properties中添加所需配置
spring.mail.host=smtp.163.com#spring.mail.port=465spring.mail.username= 邮箱用户名spring.mail.password= 邮箱密码spring.mail.default-encoding=utf-8spring.mail.properties.mail.smtp.auth=truespring.mail.properties.mail.smtp.starttls.enable=truespring.mail.properties.mail.smtp.starttls.required=true
3、在pom.xml中添加mail依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency>```
4、最后就是代码的书写
@RestControllerpublic class SendMessage { @Autowired private JavaMailSender sender; @Value("${spring.mail.username}") private String form; @RequestMapping("MailSender") public boolean MailSender(){ SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(form); message.setTo("178378***@qq.com"); message.setSubject("任职邀请函"); message.setText("欢迎拥有居住资格证的帅哥老五通过面试,请明天到百度公司任职,谢谢配合"); sender.send(message); return true; }}
5、运行idea的接口 如果看到true,就表示发送成功!
阅读全文
0 0
- SSM发送Email
- 发送Email
- EMail发送
- 发送email
- 发送email
- 发送Email
- 发送email
- 发送Email
- email 发送
- 发送email 打开email
- JSP发送EMAIL
- JSP发送EMAIL
- oracle内发送email
- java发送email
- ASP.net发送Email
- asp.net 发送email
- 用genexus发送email
- 用.net发送email
- 从数据库导出xml文件
- Mysql Tips
- 概率DP RED IS GOOD
- 【转载】Unity C# 调用C++ dll 问题集锦
- 每天积累一点(一三)--JVM之GC算法
- SSM发送Email
- [PAT]1081 Rational Sum (20)
- 分组函数嵌套
- pe下如何安装uefi gpt win7系统呢?
- 死锁及其预防
- 第十篇:TCP协议简介
- PyQt4开发环境搭建指导
- 64.最小路径和
- 如何通过一个方法来传入并处理不同泛型类型的集合