package cn.lijunkui.mail;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
public class hongzha {
// static MailService mailService;
public static void main(String[] args){
String html= "<!DOCTYPE html>\r\n" +
"<html>\r\n" +
"<head>\r\n" +
"<meta charset=\"UTF-8\">\r\n" +
"<title>Insert title here</title>\r\n" +
"</head>\r\n" +
"<body>\r\n" +
"<img src=\"cid:image1\"/> "+
"<img src=\"cid:image2\"/> "+
" <font color=\"red\"><a>我是努力的佳晨哥哥,我想hongzha你!!</a></font>\r\n" +
"</body>\r\n" +
"</html>";
List<InlineResource> list = new ArrayList<InlineResource>();
String path = MailService.class.getClassLoader().getResource("jc.jpg").getPath();
InlineResource resource = new InlineResource("image1",path);
InlineResource resource2 = new InlineResource("image2",path);
list.add(resource2);
list.add(resource);
MailService mailService = new MailService();
mailService.sendInlineResourceMail("1528939931@qq.com", "头像图片", html,list);
}
}
最近下载更多
2363659936 LV2
2022年6月21日
King_wsk LV18
2022年3月24日
bcli123 LV7
2021年12月30日
ideaCode LV4
2021年9月24日
ericxu1116 LV24
2021年7月3日
chenxiufeng LV4
2021年7月2日
pxqtsht LV16
2021年6月18日
luesjim LV11
2021年6月18日
国服后端 LV10
2021年5月21日
gshnlj LV15
2020年9月22日

最近浏览