已发送的邮件怎么撤回,qq邮箱怎么撤回发送的邮件

  • 编辑: 凤幻珊
  • 2019-11-18 02:45:00
  • 人阅读
怎么发邮件到别人邮箱,ma rte ̈rte ̈rte£发邮件...

!-- mail依赖 -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-mail/artifactId /dependency

2、参数配置

在application.properties中配置邮件相关的参数

spring.thymeleaf.cache=falsespring.mail.host=smtp.qq.comspring.mail.username=***@qq.comspring.mail.password=ymwrdffauajebgde //此处的密码时qq邮箱的授权码spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=truespring.mail.properties.mail.smtp.stattls.required=true

3、邮件Service代码

@Servicepublic class MailService {@Value(${spring.mail.username}) private String from;@Autowired private JavaMailSender sender;/*发送邮件的方法*/ public void sendSimple(String to, String title, String content){SimpleMailMessage message = new SimpleMailMessage();message.setFrom(from); //发送者message.setTo(to); //接受者message.setSubject(title); //发送标题message.setText(content); //发送内容sender.send(message);System.out.println(邮件发送成功);}}

4、编写页面代码

!DOCTYPE htmlhtml xmlns= xmlns:th=xmlns:sec=headmeta charset=UTF-8 /titleInsert title here/title/headbody h1 th:inlines=text邮件发送/h1 form action=sendMail method=postp选择文件: input type=text name=title//ppinput type=submit value=提交//p /form/body/html

5、邮件请求处理

@Controllerpublic class MailController {  @Autowired private MailService mailService;private String to=***@qq.com;@RequestMapping(mail) public String mail(){return /mail; }@RequestMapping(sendMail) @ResponseBody public String sendMail(@RequestParam(title)String title){System.out.println(-----title: title);mailService.sendSimple(to, title, title);return success; }}

6、测试

7、qq邮箱授权码

本文原标题:发送的邮件怎么撤回,邮件怎么发

版权声明:本文由 凤幻珊 整理编辑,如果侵权请联系我们!

转载注明出处:https://www.nintaus.net/houtai@123/makehtml_archives_action.php?endid=0&startid=0&typeid=0&totalnum=11732&startdd=5400&pagesize=20&seltime=0&sstime=1589370344&stime=&etime=&uptype=mkall&mkvalue=0&isremote=0&serviterm=

文章评论

共有 条评论来说两句吧...

用户名:

验证码:

Top