新建maven项目,pom添加依赖和项目构建:
<dependencies><!--spring 依赖 --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>4.3.12.RELEASE</version></dependency><!--spring mail begin --><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>4.3.12.RELEASE</version></dependency><dependency><groupId>javax.mail</groupId><artifactId>mail</artifactId><version>1.4.7</version></dependency><!--spring mail end --></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><!-- 代码检错版本号 --><source>1.8</source><!-- 代码编译版本号 --><target>1.8</target><!--项目字符集 --><encoding>UTF-8</encoding></configuration></plugin></plugins></build>
新建bean xml config文件,添加bean对象:username为自己的邮箱账号,password,是在qq邮箱设置,开启smtp服务获取到的密码。
<!-- spring mail --><bean id="mailSender"class="org.springframework.mail.javamail.JavaMailSenderImpl"><property name="host" value="" /><property name="port" value="465" /><property name="username" value="xxxxxx@" /><property name="password" value="xxxxxx" /><property name="javaMailProperties"><props><prop key="mail.smtp.auth">true</prop><prop key="mail.smtp.timeout">30000</prop><prop key="mail.debug">true</prop><prop key="mail.smtp.starttls.enable">true</prop><prop key="mail.smtp.socketFactory.class">.ssl.SSLSocketFactory</prop></props></property></bean>
编写测试类,发送一个邮件:
package com.test;import javax.mail.MessagingException;import javax.mail.internet.MimeMessage;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import org.springframework.mail.javamail.JavaMailSender;import org.springframework.mail.javamail.MimeMessageHelper;public class TestEmail2 {public static void main(String[] args) throws MessagingException {ApplicationContext context = new ClassPathXmlApplicationContext("Application.xml");JavaMailSender javaMailSender = (JavaMailSender) context.getBean("mailSender");// 创建mail对象MimeMessage message = javaMailSender.createMimeMessage();// 新建一个邮件助手MimeMessageHelper messageHelper = new MimeMessageHelper(message,false, "UTF-8"); //为true可以添加附件。// 设置发送者messageHelper.setFrom("my@");// 设置接收者messageHelper.setTo("he@");// 设置标题messageHelper.setSubject("我是来自未来的你!");// 设置内容messageHelper.setText("<h1>兄弟抱一下</h1>", true);// 添加附件:messageHelper.addAttachment("附件1.jsp", new File("C:\\Users\\chair\\Desktop\\info.jsp"));javaMailSender.send(message);}}
发送静态网页:
package com.test;import java.io.File;import javax.mail.MessagingException;import javax.mail.internet.MimeMessage;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import org.springframework.mail.javamail.JavaMailSender;import org.springframework.mail.javamail.MimeMessageHelper;public class TestEmail {public static void main(String[] args) throws MessagingException {ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");// 拿到邮件发送者对象JavaMailSender javaMailSender = (JavaMailSender) context.getBean("mailSender");// 创一个邮件对象MimeMessage message = javaMailSender.createMimeMessage();// 新建一个邮件助手// MimeMessageHelper messageHelper = new MimeMessageHelper(message, "UTF-8");// 第二个参数设置是否为附件邮件MimeMessageHelper messageHelper = new MimeMessageHelper(message, "UTF-8");// 设置发送者messageHelper.setFrom("my@");// 设置目的地messageHelper.setTo("he@");// Carbon Copy(抄送)// messageHelper.setCc(cc);// Blind Carbon Copy(暗抄送)。// messageHelper.setBcc(bcc);// 邮件内容// 第二个参数为true时。内容是htmlString html = "<!doctype html>\r\n" + "<html>\r\n" + "<head>\r\n" + "<meta charset=\"utf-8\">\r\n"+ "<title>注册就送诸葛皮肤888</title>\r\n" + "\r\n" + "<style>\r\n" + "\r\n" + "* {\r\n" + " margin: 0;\r\n"+ " padding: 0;\r\n" + "}\r\n" + "body {\r\n"+ " background-image: url(../img/background_img/b.jpg);\r\n"+ " background-repeat: no-repeat;\r\n" + " background-position: center top;\r\n"+ " background-color: #FAFAFA;\r\n" + " font-family: \"微软雅黑\";\r\n" + "}\r\n" + "h1 {\r\n"+ " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n" + " font-size: 20px;\r\n"+ " padding: 10px 0 10px 20px;\r\n" + "}\r\n" + "h3 {\r\n" + " padding-bottom: 10px;\r\n"+ " padding-left: 20px;\r\n" + " padding-top: 10px;\r\n" + " color: #686868;\r\n" + "}\r\n"+ "li {\r\n" + " list-style-type: square;\r\n" + "}\r\n" + ".clear {\r\n" + " clear: both;\r\n"+ "}\r\n" + "/*--------导航栏样式--------*/\r\n" + "#headside {\r\n" + " margin: 0 auto;\r\n"+ " width: 960px;\r\n" + " margin-bottom: 20px;\r\n" + " margin-top: 250px;\r\n" + "}\r\n"+ "#main-nav {\r\n" + " background-color: rgba(48,38,77,0.80);\r\n" + " border-radius: 10px;\r\n"+ "}\r\n" + "#main-nav ul {\r\n" + " list-style-type: none;\r\n"+ " padding: 10px 0 15px 10px;\r\n" + " text-align: center;\r\n" + "}\r\n" + "#main-nav li {\r\n"+ " display: inline;\r\n" + " margin: 0 65px 0 20px;\r\n" + "}\r\n" + "#main-nav a {\r\n"+ " text-decoration: none;\r\n" + " color: #FFFFFF;\r\n" + " font-size: 28px;\r\n"+ " padding: 10px 10px 10px 10px;\r\n" + "}\r\n" + "#main-nav a:hover {\r\n"+ " background-color: #FFFFFF;\r\n" + " padding: 5px 10px 10px 10px;\r\n"+ " border-radius: 10px;\r\n" + " color: #423468;\r\n" + "}\r\n" + "/*--------主体样式--------*/\r\n"+ "#wrapper {\r\n" + " width: 960px;\r\n" + " background-color: #FFFFFF;\r\n"+ " margin: 0 auto;\r\n" + " border-radius: 10px;\r\n" + " margin-bottom: 50px;\r\n" + "}\r\n"+ "/*--------介绍模块样式--------*/\r\n" + "#introduce {\r\n" + " background-color: #F9F9F9;\r\n"+ " border-radius: 10px 10px 0 0;\r\n" + "}\r\n" + "#introduce h1 {\r\n"+ " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n" + " font-size: 20px;\r\n"+ " padding: 10px 0 10px 20px;\r\n" + " border-radius: 10px 10px 0 0;\r\n" + "}\r\n"+ "#introduce p {\r\n" + " padding: 20px 30px 20px 30px;\r\n" + " font-size: 17px;\r\n"+ " color: #575757;\r\n" + "}\r\n" + "/*--------图片集样式--------*/\r\n" + "#imgs {\r\n"+ " width: 460px;\r\n" + " float: left;\r\n" + "}\r\n" + "table.hero_img {\r\n"+ " border-collapse: collapse;\r\n" + "}\r\n" + "table.hero_img table {\r\n"+ " border-collapse: collapse;\r\n" + "}\r\n" + "table.hero_img img {\r\n"+ " vertical-align: bottom;\r\n" + "}\r\n" + "img.bigpic {\r\n" + " width: 400px;\r\n"+ " height: 350px;\r\n" + "}\r\n" + "table.hero_img td td img {\r\n" + " width: 60px;\r\n"+ " height: 70px;\r\n" + " opacity: 1;\r\n" + " opacity: 0.5;\r\n" + "}\r\n"+ "table.hero_img td td img:hover {\r\n" + " opacity: 1;\r\n" + "}\r\n"+ "/*--------文字模块样式--------*/\r\n" + ".word {\r\n" + " width: 499px;\r\n"+ " font-size: 16px;\r\n" + " float: left;\r\n" + "}\r\n" + "/*----攻略样式----*/\r\n"+ "#gonglue hr {\r\n" + " width: 300px;\r\n" + " margin: 0 auto;\r\n"+ " margin-left: 5px;\r\n" + "}\r\n" + "#gonglue {\r\n" + " float: left;\r\n"+ " width: 300px;\r\n" + " font-size: 12px;\r\n" + "}\r\n" + "#gonglue ul {\r\n"+ " width: 300px;\r\n" + "}\r\n" + "#gonglue li {\r\n" + " padding-top: 5px;\r\n"+ " padding-bottom: 5px;\r\n" + " padding-left: 10px;\r\n" + " margin-bottom: 8px;\r\n"+ " margin-top: 1px;\r\n" + " margin-left: 20px;\r\n" + " width: 360px;\r\n"+ " list-style-type: none;\r\n" + "}\r\n" + "#gonglue a {\r\n" + " text-decoration: none;\r\n"+ " color: #000000;\r\n" + "}\r\n" + "#gonglue li:hover {\r\n" + " background-color: #423468;\r\n"+ " color: #FFFFFF;\r\n" + " border-radius: 20px;\r\n" + " width: 280px;\r\n" + "}\r\n"+ "#gonglue .button {\r\n" + " background-color: #838383;\r\n" + " border: none;\r\n"+ " text-align: center;\r\n" + " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n"+ " font-family: \"微软雅黑\";\r\n" + " border-radius: 5px;\r\n" + " width: 250px;\r\n"+ " margin-left: 20px;\r\n" + "}\r\n" + "#gonglue .button:hover {\r\n"+ " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n" + " border: none;\r\n"+ " text-align: center;\r\n" + " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n"+ " font-family: \"微软雅黑\";\r\n" + " width: 250px;\r\n" + "}\r\n" + "/*----爆料样式----*/\r\n"+ "#baoliao {\r\n" + " float: left;\r\n" + " width: 180px;\r\n" + " margin-left: -5px;\r\n"+ " font-size: 12px;\r\n" + "}\r\n" + "#baoliao li {\r\n" + " list-style-type: square;\r\n"+ " font-size: 12px;\r\n" + " padding-top: 3px;\r\n" + " padding-bottom: 5px;\r\n"+ " padding-left: 10px;\r\n" + " margin-bottom: 6px;\r\n" + " margin-top: 1px;\r\n"+ " margin-left: 10px;\r\n" + " list-style-type: none;\r\n" + "}\r\n" + "#baoliao hr {\r\n"+ " width: 120px;\r\n" + " margin: 0 auto;\r\n" + "}\r\n" + "#baoliao .button {\r\n"+ " background-color: #838383;\r\n" + " border: none;\r\n" + " text-align: center;\r\n"+ " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n" + " font-family: \"微软雅黑\";\r\n"+ " border-radius: 5px;\r\n" + " width: 180px;\r\n" + " margin-left: 10px;\r\n"+ " margin-top: 3px;\r\n" + "}\r\n" + "#baoliao .button:hover {\r\n"+ " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n" + " border: none;\r\n"+ " text-align: center;\r\n" + " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n"+ " font-family: \"微软雅黑\";\r\n" + " width: 180px;\r\n" + " margin-left: 10px;\r\n" + "}\r\n"+ "/*--------问卷样式--------*/\r\n" + "#question {\r\n" + " width: 350px;\r\n" + " float: left;\r\n"+ "}\r\n" + "#question p {\r\n" + " margin-bottom: 20px;\r\n" + "}\r\n" + ".wenjuan {\r\n"+ " padding: 20px 10px 0 20px;\r\n" + " border-bottom: 10px solid #423468;\r\n" + "}\r\n"+ ".wenjuan input {\r\n" + " margin-bottom: 20px;\r\n" + " margin-left: 10px;\r\n" + "}\r\n"+ "/*----搜索栏样式----*/\r\n" + ".sousuo {\r\n" + " padding: 50px 50px 50px 50px;\r\n" + "}\r\n"+ ".sousuo h3 {\r\n" + " margin-bottom: 5px;\r\n" + " margin-top: -50px;\r\n"+ " margin-left: -50px;\r\n" + " color: #686868;\r\n" + "}\r\n" + ".sousuo .text {\r\n"+ " padding: 10px 10px 10px 10px;\r\n" + " border-radius: 5px;\r\n" + "}\r\n"+ ".sousuo .submit {\r\n" + " background-color: #838383;\r\n" + " border: none;\r\n"+ " text-align: center;\r\n" + " font-size: 18px;\r\n" + " /*padding: 5px 10px 5px 10px;*/\r\n"+ " font-family: \"微软雅黑\";\r\n" + " border-radius: 5px;\r\n" + " margin-left: 8px;\r\n"+ " padding: 5px 4px 5px 4px\r\n" + "}\r\n" + ".sousuo .submit:hover {\r\n"+ " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n" + " border: none;\r\n"+ " text-align: center;\r\n" + " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n"+ " font-family: \"微软雅黑\";\r\n" + " border-radius: 5px;\r\n" + " margin-left: 8px;\r\n"+ " padding: 5px 4px 5px 4px;\r\n" + "}\r\n" + "/*----提交按钮样式----*/\r\n" + ".button {\r\n"+ " background-color: #838383;\r\n" + " border: none;\r\n" + " text-align: center;\r\n"+ " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n" + " font-family: \"微软雅黑\";\r\n"+ " border-radius: 5px;\r\n" + "\r\n" + "}\r\n" + ".button:hover {\r\n"+ " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n" + " border: none;\r\n"+ " text-align: center;\r\n" + " font-size: 18px;\r\n" + " padding: 5px 10px 5px 10px;\r\n"+ " font-family: \"微软雅黑\";\r\n" + " border-radius: 5px;\r\n" + "}\r\n"+ "/*--------视频样式--------*/\r\n" + "\r\n" + "#medio {\r\n" + " float: left;\r\n"+ " background-color: #000000;\r\n" + "}\r\n" + "/*--------图区样式--------*/\r\n" + "#three hr {\r\n"+ " width: 920px;\r\n" + " margin: 0 auto;\r\n" + " margin-bottom: 20px;\r\n"+ " margin-right: 20px;\r\n" + "}\r\n" + "#xyx {\r\n" + " float: left;\r\n"+ " margin-left: 20px;\r\n" + "}\r\n" + "#xyx img {\r\n" + " width: 280px;\r\n"+ " margin-left: 20px;\r\n" + "}\r\n" + "#xpf {\r\n" + " float: left;\r\n"+ " margin-left: 20px;\r\n" + "}\r\n" + "#xpf img {\r\n" + " width: 280px;\r\n"+ " margin-left: 20px;\r\n" + " margin-bottom: 30px;\r\n" + "}\r\n"+ "/*--------专区样式--------*/\r\n" + "#four ul {\r\n" + " font-size: 14px;\r\n" + "}\r\n"+ "#dashen {\r\n" + " width: 320px;\r\n" + " float: left;\r\n" + "}\r\n" + "#dashen hr {\r\n"+ " width: 300px;\r\n" + " margin: 0 auto;\r\n" + " margin-bottom: 10px;\r\n" + "}\r\n"+ "#dashen li {\r\n" + " margin-bottom: 14px;\r\n" + " margin-left: 25px;\r\n" + "}\r\n"+ "#yingxiong {\r\n" + " width: 320px;\r\n" + " float: left;\r\n" + "}\r\n"+ "#yingxiong hr {\r\n" + " width: 300px;\r\n" + " margin: 0 auto;\r\n"+ " margin-bottom: 10px;\r\n" + "}\r\n" + "#yingxiong li {\r\n" + " margin-bottom: 14px;\r\n"+ " margin-left: 25px;\r\n" + "}\r\n" + "#wenda {\r\n" + " width: 320px;\r\n"+ " float: left;\r\n" + "}\r\n" + "#wenda hr {\r\n" + " width: 300px;\r\n"+ " margin: 0 auto;\r\n" + " margin-bottom: 10px;\r\n" + "}\r\n" + "#wenda li {\r\n"+ " margin-bottom: 14px;\r\n" + " margin-left: 25px;\r\n" + "}\r\n"+ "/*--------页脚样式--------*/\r\n" + "/*----超链接样式----*/\r\n" + "#chaolianjie {\r\n"+ " margin-top: 50px;\r\n" + " padding: 20px 0;\r\n" + " background-color: #333;\r\n"+ " overflow: hidden;\r\n" + " padding: 20px 300px 20px 300px;\r\n" + "}\r\n"+ "#chaolianjie h4 {\r\n" + " color: #AAAAAA;\r\n" + " border-bottom: 1px solid #444;\r\n"+ " height: 24px;\r\n" + " overflow: hidden;\r\n" + " font-size: 14px;\r\n"+ " margin-left: 10px;\r\n" + "}\r\n" + "#chaolianjie a {\r\n" + " line-height: 24px;\r\n"+ " padding: 0 10px;\r\n" + " font-size: 12px;\r\n" + " color: #777;\r\n"+ " word-wrap: break-word;\r\n" + " display: inline-block;\r\n" + " text-decoration: none;\r\n"+ " margin-top: 10px;\r\n" + "}\r\n" + "/*----footer----*/\r\n" + "#footer {\r\n"+ " width: 100%;\r\n" + " height: 50px;\r\n" + " overflow: hidden;\r\n"+ " background-color: #252525;\r\n" + " padding: 25px 0 0;\r\n" + "}\r\n" + "#footer p {\r\n"+ " text-align: center;\r\n" + " line-height: 20px;\r\n" + " color: #4f4f4f;\r\n"+ " padding-bottom: 25px;\r\n" + "}\r\n" + "\r\n" + "@charset \"utf-8\";\r\n"+ "/* CSS Document */\r\n" + "* {\r\n" + " margin: 0;\r\n" + " padding: 0;\r\n" + "}\r\n"+ "h1 {\r\n" + " background-color: #423468;\r\n" + " color: #FFFFFF;\r\n"+ " font-size: 20px;\r\n" + " padding: 10px 0 10px 20px;\r\n"+ " border-radius: 10px 10px 0 0;\r\n" + "}\r\n" + "h3 {\r\n" + " padding-bottom: 10px;\r\n"+ " padding-left: 20px;\r\n" + " padding-top: 10px;\r\n" + " color: #686868;\r\n" + "}\r\n"+ "li {\r\n" + " list-style-type: square;\r\n" + "}\r\n" + ".clear {\r\n" + " clear: both;\r\n"+ "}\r\n" + "/*--------导航样式--------*/\r\n" + "#headside {\r\n" + " margin: 0 auto;\r\n"+ " width: 960px;\r\n" + " margin-bottom: 20px;\r\n" + " margin-top: 250px;\r\n" + "}\r\n"+ "#main-nav {\r\n" + " background-color: rgba(48,38,77,0.80);\r\n" + " border-radius: 10px;\r\n"+ "}\r\n" + "#main-nav ul {\r\n" + " list-style-type: none;\r\n"+ " padding: 10px 0 15px 10px;\r\n" + " text-align: center;\r\n" + "}\r\n" + "#main-nav li {\r\n"+ " display: inline;\r\n" + " margin: 0 65px 0 20px;\r\n" + "}\r\n" + "#main-nav a {\r\n"+ " text-decoration: none;\r\n" + " color: #FFFFFF;\r\n" + " font-size: 28px;\r\n"+ " padding: 10px 10px 10px 10px;\r\n" + "}\r\n" + "#main-nav a:hover {\r\n"+ " background-color: #FFFFFF;\r\n" + " padding: 5px 10px 10px 10px;\r\n"+ " border-radius: 10px;\r\n" + " color: #423468;\r\n" + "}\r\n" + "/*--------页脚样式--------*/\r\n"+ "/*----超链接样式----*/\r\n" + "#chaolianjie {\r\n" + " margin-top: 50px;\r\n"+ " padding: 20px 0;\r\n" + " background-color: #333;\r\n" + " overflow: hidden;\r\n"+ " padding:20px 300px 20px 300px;\r\n" + "}\r\n" + "#chaolianjie h4 {\r\n"+ " color: #AAAAAA;\r\n" + " border-bottom: 1px #444 solid;\r\n" + " height: 24px;\r\n"+ " overflow: hidden;\r\n" + " font-size: 14px;\r\n" + " margin-left: 10px;\r\n" + "}\r\n"+ "#chaolianjie a {\r\n" + " line-height: 24px;\r\n" + " padding: 0 10px;\r\n"+ " font-size: 12px;\r\n" + " color: #777;\r\n" + " word-wrap: break-word;\r\n"+ " display: inline-block;\r\n" + " text-decoration: none;\r\n" + " margin-top: 10px;\r\n"+ "}\r\n" + "/*----footer----*/\r\n" + "#footer {\r\n" + " width: 100%;\r\n"+ " height: 50px;\r\n" + " overflow: hidden;\r\n" + " background-color: #252525;\r\n"+ " padding: 25px 0 0;\r\n" + "}\r\n" + "#footer p {\r\n" + " text-align: center;\r\n"+ " line-height: 20px;\r\n" + " color: #4f4f4f;\r\n" + " padding-bottom: 25px;\r\n" + "}\r\n"+ "\r\n" + "\r\n" + "</style>\r\n" + "</head>\r\n" + "<body>\r\n"+ "<img class=\"currentImg\" id=\"currentImg\" οnlοad=\"alog && alog('speed.set', 'c_firstPageComplete', +new Date); alog.fire && alog.fire('mark');\" src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.png\" width=\"925.17006802721\" height=\"425\" style=\"top: 61px; left: 0px; width: 100%; height: 720px; cursor: pointer;\" log-rightclick=\"p=5.102\" title=\"点击查看源网页\">\r\n"+ "<!--导航栏-->\r\n" + "<div id=\"headside\">\r\n" + " <div id=\"main-nav\">\r\n" + " <ul>\r\n"+ "<li><a href=\"子页面/游戏攻略.html\" target=\"_blank\"><b>游戏攻略</b></a></li>\r\n"+ "<li><a href=\"子页面/精彩视频.html\" target=\"_blank\"><b>精彩视频</b></a></li>\r\n"+ "<li><a href=\"子页面/赛事介绍.html\" target=\"_blank\"><b>赛事介绍</b></a></li>\r\n"+ "<li><a href=\"子页面/游戏下载.html\" target=\"_blank\"><b>游戏下载</b></a></li>\r\n" + " </ul>\r\n"+ " </div>\r\n" + "</div>\r\n" + "<div id=\"wrapper\"> \r\n" + "\r\n" + " <!--游戏简介-->\r\n"+ " <div id=\"introduce\">\r\n" + " <h1>\r\n" + "<li>游戏介绍</li>\r\n" + " </h1>\r\n"+ " <p>《王者荣耀》是腾讯第一5V5英雄公平对战手游,于10月28日开启不限号测试!5V5王者峡谷(含迷雾模式)、5V5深渊大乱斗、以及3V3、1V1等多样模式一键体验,热血竞技尽享快感!海量英雄随心选择,精妙配合默契作战!10秒实时跨区匹配,与好友组队登顶最强王者!操作简单易上手,一血、五杀、超神,极致还原经典体验!实力操作公平对战,回归MOBA初心!</p>\r\n"+ " </div>\r\n" + " <!--模块1-->\r\n" + "\r\n" + " <div id=\"one\">\r\n"+ " <div class=\"clear\"></div>\r\n" + " <!--英雄图集-->\r\n" + " <div id=\"imgs\">\r\n"+ "<h1>\r\n" + " <li>热门英雄</li>\r\n" + "</h1>\r\n"+ "<table class=\"hero_img\">\r\n" + " <tr>\r\n"+ "<td><img src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.png\" class=\"bigpic\"></td>\r\n"+ "<td width=\"111\"><table width=\"100%\">\r\n" + " <tr>\r\n"+ "<td><img src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.png\"></td>\r\n"+ " </tr>\r\n" + " <tr>\r\n"+ "<td><img src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.png\"></td>\r\n"+ " </tr>\r\n" + " <tr>\r\n"+ "<td><img src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.pngimg/hero_img/苏列.jpg\"></td>\r\n"+ " </tr>\r\n" + " <tr>\r\n"+ "<td><img src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.pngimg/hero_img/苏列.jpg\"></td>\r\n"+ " </tr>\r\n" + " <tr>\r\n"+ "<td><img src=\"/timg?image&quality=80&size=b9999_10000&sec=1592389900545&di=736eb99613ff39fc9a5cb6df8de5345b&imgtype=0&src=http%3A%2F%2F09.%2Fmobile%2F0807%2F0807225254_d0ea35bc9d2f3fc5e6ef55f30d046fb0_1.pngimg/hero_img/妲己.jpg\"></td>\r\n"+ " </tr>\r\n" + " </table></td>\r\n" + " </tr>\r\n"+ "</table>\r\n" + " </div>\r\n" + " <div class=\"word\">\r\n" + "<h1> </h1>\r\n"+ "<div id=\"gonglue\">\r\n" + " <ul >\r\n" + "<h3>最新攻略</h3>\r\n"+ "<hr>\r\n" + "<a href=\"#\">\r\n"+ "<li>【视频教学】瓶子英雄周报:强辅扁鹊治疗伤害...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【视频教学】龍岩解说:鲁班七号隐后排巧妙三...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【攻略指南】百里玄策干货教学:完美诠释收割...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【攻略指南】白起大招隐藏技巧 嘲讽可获得双倍...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【视频教学】月光之女露娜打野套路教学 野区里...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【视频教学】扁鹊上演绝地反击秀 一波拆家强势...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【攻略指南】听说这套铭文和露娜的月下无限连...</li>\r\n" + "</a> <a href=\"#\">\r\n"+ "<li>【攻略指南】女娲铭文如何选择 女娲顶级铭文搭...</li>\r\n" + "</a>\r\n"+ "<input type=\"button\" class=\"button\" value=\"点击查看更多王者荣耀攻略\">\r\n" + " </ul>\r\n"+ "</div>\r\n" + "<div id=\"baoliao\">\r\n" + " <h3>爆料站</h3>\r\n"+ " <hr>\r\n" + " <ul>\r\n" + "<li>星耀王者局被禁英雄 ...</li>\r\n"+ "<li>体验服一大波新皮肤 ...</li>\r\n" + "<li>公孙离全技能曝光: ...</li>\r\n"+ "<li>活动大爆料:逐梦之...</li>\r\n" + "<li>新皮肤爆料:炫酷弹 ...</li>\r\n"+ "<li>逐梦之星模型特效预 ...</li>\r\n" + "<li>夏侯惇模型重做抢先 ...</li>\r\n"+ "<li>为维护良好游戏环境 ...</li>\r\n" + "<li>体验【资格申请活动 ...</li>\r\n" + " </ul>\r\n"+ " <input type=\"button\" class=\"button\" value=\"点击查看更多爆料\">\r\n" + "</div>\r\n"+ " </div>\r\n" + " <div class=\"clear\"></div>\r\n" + "\r\n" + " <!--模块3-->\r\n"+ " <div id=\"two\"> \r\n" + "<!--问卷调查表单-->\r\n" + "<div id=\"question\">\r\n"+ " <h1>\r\n" + "<li>王者小问卷</li>\r\n" + " </h1>\r\n"+ " <div class=\"form\">\r\n" + "<form class=\"wenjuan\">\r\n"+ " <p>请在热门英雄中选出您最喜欢使用的英雄:</p>\r\n"+ " <input type=\"radio\" name=\"hero\" value=\"孙悟空\">\r\n" + " 孙悟空\r\n"+ " <input type=\"radio\" name=\"hero\" value=\"貂蝉\">\r\n" + " 貂蝉\r\n"+ " <input type=\"radio\" name=\"hero\" value=\"明世隐\">\r\n" + " 明世隐\r\n"+ " <input type=\"radio\" name=\"hero\" value=\"苏烈\">\r\n" + " 苏列 <br>\r\n"+ " <input type=\"submit\" class=\"button\" value=\"提交\">\r\n" + "</form>\r\n"+ "<form class=\"sousuo\">\r\n" + " <h3>站内搜索</h3>\r\n" + " <span>\r\n"+ " <input type=\"text\" placeholder=\"请输入关键词\" class=\"text\">\r\n"+ " </span> <span>\r\n"+ " <input type=\"submit\" class=\"submit\" value=\"搜索\">\r\n" + " </span>\r\n"+ "</form>\r\n" + " </div>\r\n" + "</div>\r\n" + "<!--游戏视频-->\r\n"+ "<div id=\"medio\">\r\n" + " <h1>\r\n" + "<li>精彩CG</li>\r\n"+ " </h1>\r\n" + " <video width=\"610\" height=\"300\" controls autoplay>\r\n"+ "<source src=\"/634275394954596a6179414679647a66/5a6d357347726b35/731c387869e347de91add26969181082238a15de6d970e4583b3d626ddbb7d0835a1b50d22105204ec11ff9bd02f8e1c.mp4?auth_key=1592387403-0-0-2fb7aaa9f4944d97c107391e0586bb4e\" type=\"video/mp4\">\r\n"+ " </video>\r\n" + "</div>\r\n" + "<div class=\"clear\"></div>\r\n"+ " </div>\r\n" + " </div>\r\n" + " <!--模块3图区-->\r\n" + " <div id=\"three\">\r\n" + " <h1>\r\n"+ "<li>最新图讯</li>\r\n" + " </h1>\r\n" + " <div id=\"xyx\">\r\n" + "<h3>最新英雄</h3>\r\n"+ "<hr>\r\n"+ "<img src=\"img/hero_img/新英雄明世隐.jpg\"> <img src=\"img/hero_img/新英雄女娲.jpg\"> <img src=\"img/hero_img/新英雄梦奇.jpg\"> </div>\r\n"+ " <div id=\"xpf\">\r\n" + "<h3>最新皮肤</h3>\r\n" + "<hr>\r\n"+ "<img src=\"img/hero_img/逐梦之星.jpg\"> <img src=\"img/hero_img/占星术士.jpg\"> <img src=\"img/hero_img/霸王丸.jpg\"> </div>\r\n"+ " </div>\r\n" + " <div class=\"clear\"></div>\r\n" + " <!--模块4专栏-->\r\n"+ " <div id=\"four\">\r\n" + " <h1>\r\n" + "<li>专栏区</li>\r\n" + " </h1>\r\n"+ " <div id=\"dashen\">\r\n" + "<h3>大神专栏</h3>\r\n" + "<hr>\r\n" + "<ul>\r\n"+ " <li>新版本貂蝉这么强怎么玩 五个英雄轻松压制</li>\r\n" + " <li>为何阿轲在高端局难见踪影 死亡之刃高端局</li>\r\n"+ " <li>杀人最优雅的三位英雄 玩家表示遇见他们愿</li>\r\n" + " <li>大招范围最大的英雄 王昭君排第二它才是最</li>\r\n"+ " <li>知道你的法师为什么没伤害吗 因为你没有出</li>\r\n" + " <li>超详细铭文推荐 还在纠结配铭文的小伙伴赶</li>\r\n"+ " <li>18888金币孙悟空和吕布如何抉择 英雄性价</li>\r\n" + " <li>S9赛季星耀局以下超强战士盘点 橘右京勇夺</li>\r\n"+ " <li>王者荣耀为什么会火 1分钟带你看清这款游戏</li>\r\n" + " <li>3D视角下的英雄面貌 火舞太美上天梦奇是真</li>\r\n"+ "</ul>\r\n" + " </div>\r\n" + " <div id=\"yingxiong\">\r\n" + "<h3>英雄专栏</h3>\r\n"+ "<hr>\r\n" + "<ul>\r\n" + " <li>王者荣耀明世隐怎么出装 明世隐出装顺序推荐</li>\r\n"+ " <li>王者荣耀曦技能动态图赏 大招超远射程自带位</li>\r\n" + " <li>王者荣耀曦多少钱 新英雄曦金币售价全曝光</li>\r\n"+ " <li>王者荣耀曦铭文搭配推荐 带你玩转超强传送法</li>\r\n" + " <li>王者荣耀新英雄时间表 上线时间曝光</li>\r\n"+ " <li>王者荣耀干将莫邪重做出装推荐 新版暴力出装</li>\r\n" + " <li>王者荣耀奕星大招重做 群体沉默外加禁锢强势</li>\r\n"+ " <li>王者荣耀最坑英雄排行 遇到他们想赢都难</li>\r\n" + " <li>王者荣耀最新单挑王梦奇 1V1单挑胜率达到68</li>\r\n"+ " <li>王者荣耀亚瑟新皮肤爆料:最丑尬舞不忍直视</li>\r\n" + "</ul>\r\n" + " </div>\r\n"+ " <div id=\"wenda\">\r\n" + "<h3>玩家问答</h3>\r\n" + "<hr>\r\n" + "<ul>\r\n"+ " <li>王者荣耀五军之战什么时候上线体验服 新模</li>\r\n" + " <li>王者荣耀五军之战什么时候上线正式服 新模</li>\r\n"+ " <li>王者荣耀五军之战有什么亮点 新模式亮点介</li>\r\n" + " <li>王者荣耀五军之战有什么技能五军之战特有技</li>\r\n"+ " <li>王者荣耀五军之战怎么获取经济新模式地图资</li>\r\n" + " <li>王者荣耀五军之战怎么获得胜利五军战获胜方</li>\r\n"+ " <li>王者荣耀五军之战好玩吗 新模式玩法大揭秘</li>\r\n" + " <li>王者荣耀五军之战怎么玩 新模式五军之战全揭</li>\r\n"+ " <li>王者荣耀公孙离怎么出装 新射手英雄出装攻略</li>\r\n" + " <li>王者荣耀公孙离铭文怎么搭配 公孙离铭文搭配</li>\r\n"+ "</ul>\r\n" + " </div>\r\n" + " </div>\r\n" + " <div class=\"clear\"></div>\r\n"+ "</div>\r\n" + "<div id=\"foot\">\r\n" + " <div id=\"chaolianjie\">\r\n" + " <h4>友情链接</h4>\r\n"+ "\r\n"+ " <a href=\"/\">游戏官网</a> <a href=\"/history/\">文化中心</a> <a href=\"#\">加入我们</a> <a href=\"#\">作者主页</a> </div>\r\n"+ " <div id=\"footer\"> \r\n" + " <p>Copyright ©. All rights reserved. 注册就送诸葛皮肤888</p>\r\n"+ "\r\n" + " </div>\r\n" + "</div>\r\n" + "</body>\r\n" + "\r\n" + "<script>\r\n"+ "window.onload = function(){\r\n" + " var pic = document.getElementsByTagName(\"img\");\r\n"+ "\r\n" + " for(var i = 1; i < pic.length; i++){\r\n"+ " pic.item(i).addEventListener(\"click\",changebigpic,0);\r\n" + " }\r\n" + "\r\n"+ " function changebigpic(event){\r\n" + " var newsrc = event.target.src;\r\n"+ " var bigpic = document.getElementsByClassName(\"bigpic\").item(0);\r\n"+ " bigpic.setAttribute(\"src\",newsrc);\r\n" + " }\r\n" + "}\r\n" + "</script>\r\n"+ "</html>\r\n" + "";messageHelper.setText(html, true);// 邮件主题messageHelper.setSubject("我是标题!!");// 添加附件//messageHelper.addAttachment("附件1.jsp", new File("C:\\Users\\chair\\Desktop\\info.jsp"));for (int i = 0; i < 1; i++) {javaMailSender.send(message);}}}
如果觉得《Spring-Mail发邮件》对你有帮助,请点赞、收藏,并留下你的观点哦!