@Test //发送复杂邮件 void contextLoads2() throws MessagingException { MimeMessage mimeMessage = mailSender.createMimeMessage(); //组装 MimeMessageHelper helper = new MimeMessageHelper(mimeMessage,true); //正文 helper.setSubject("xxx你好啊"); helper.setText("<h1 style='color:red'>java这条路行下去</h1>",true); //附件 helper.addAttachment("卡伊娃.jpg",new File("C:\\Users\\pc\\Desktop\\favicon.ico")); helper.addAttachment("莱纳德.jpg",new File("C:\\Users\\pc\\Desktop\\favicon.ico")); helper.setTo("[email protected]"); helper.setFrom("[email protected]"); mailSender.send(mimeMessage); }
springboot-异步、发送邮件(二)
猜你喜欢
转载自www.cnblogs.com/shiguanzui/p/11973173.html
今日推荐
周排行