Example #1
0
 // 发送html+附件
 private static Boolean sendHtmlAttach() {
   MailContent mailInfo = new MailContent();
   mailInfo.setMailServerHost(mailServerHost);
   mailInfo.setMailServerPort(mailServerPort);
   mailInfo.setValidate(true);
   mailInfo.setUserName(fromMail);
   mailInfo.setPassword(fromMailPasswd);
   mailInfo.setFromAddress(fromMail);
   mailInfo.setToAddress(toMail);
   mailInfo.setNick(nick1);
   mailInfo.setSubject("HTML+附件类信息");
   // html内容
   String htmlContent =
       "<table style='border:solid 1px #add9c0;'>"
           + "<tr>"
           + "<th>标题</th>"
           + "<th>时间</th>"
           + "<th>内容</th>"
           + "</tr>"
           + "<tr>"
           + "<td>1111</td>"
           + "<td>1111</td>"
           + "<td>1111</td>"
           + "</tr>"
           + "</table>";
   mailInfo.setContent(htmlContent);
   // 附件
   mailInfo.setAttachFileNames(new String[] {"F:\\welcome.txt"});
   Boolean result = MailSender.sendHtmlMail(mailInfo);
   return result;
 }
Example #2
0
 // 发送附件
 private static Boolean sendAttach() {
   MailContent mailInfo = new MailContent();
   mailInfo.setMailServerHost(mailServerHost);
   mailInfo.setMailServerPort(mailServerPort);
   mailInfo.setValidate(true);
   mailInfo.setUserName(fromMail);
   mailInfo.setPassword(fromMailPasswd);
   mailInfo.setFromAddress(fromMail);
   mailInfo.setToAddress(toMail);
   mailInfo.setNick(nick3);
   mailInfo.setSubject("附件类信息");
   // 附件
   mailInfo.setAttachFileNames(new String[] {"F:\\welcome.txt"});
   Boolean result = MailSender.sendHtmlMail(mailInfo);
   return result;
 }