<img src='http://luxury.ce.cn/residence/jctj/200804/24/W020080424488069399217.jpg'/>如题
解决方案 »
- 纠结Hibernate ORACLE 分页问题。请大家帮忙看下,为什么?
- webService异常问题。
- 不显示删除回复显示所有回复显示星级回复显示得分回复 MyEclipse导入已有工程时,提示unbound classpath variable
- 求: equniox 集成 struts2 列子
- 乱码问题求高手进!!!!!
- 学习hibernate+struts遭遇NoClassDefFoundError,请大侠过来看看
- JList运行问题
- jdbc事务问题 数据库sqlserver
- 高分求一编程题!!有志者请进来!!!^_^
- 为什么weblogic7在2K下老死机?(快救我啊)
- 关于spring getHibernateTemplate().save 的问题
- spring连接数据库的时候The processing instruction must begin with the name of the target
2 你这个图片是在你的站里 还是其他人的站里 其他人的站有没做防盗链。
3 你的邮件html代码组织的对不对。
2.就直接用了谷歌的Login图片
3.应该没问题
...
/**
* @param reply
* 回复地址
* @param to
* 收信人地址
* @param subject
* 邮件标题
* @param email
* 邮件正文
*/
public static boolean sendHtmlEmail(String reply, String to,
String subject, String email) { String smtpServer = Constants.Email_SMTP; // SMTP服务器名
String name = Constants.Email_LoginName; // 邮箱登录名
String passWord = Constants.Email_LoginPassword; // 邮箱密码 Properties props = new Properties();
Session sendMailSession;
Transport transport;
sendMailSession = Session.getInstance(props); props.put("mail.smtp.host", smtpServer);
props.put("mail.smtp.port", 465);
props.put("mail.smtp.auth", "true"); MimeMessage message = new MimeMessage(sendMailSession); try {
message.setFrom(new InternetAddress("Mingoe<"
+ Constants.Email_Server + ">"));
InternetAddress[] address = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.TO, address);
message.setSubject(subject); // 设置邮件发送时间,将来要和服务器时间互转
Calendar clientCal = Calendar.getInstance();
message.setSentDate(clientCal.getTime()); BodyPart mdp = new MimeBodyPart(); // 新建一个存放信件内容的BodyPart对象
if (!isYahooEmail(to)) {
mdp.setContent(email, "text/html;charset=UTF-8"); // 给BodyPart对象设置内容和格式/编码方式
} else {
mdp.setContent(email, "text/html;charset=GBK"); // 给BodyPart对象设置内容和格式/编码方式
}
Multipart mp = new MimeMultipart(); // 新建一个MimeMultipart对象用来存放BodyPart对象
mp.addBodyPart(mdp); // 将BodyPart加入到MimeMultipart对象中
message.setContent(mp); // 把mm作为消息对象的内容 transport = sendMailSession.getTransport("smtp");
transport.connect(smtpServer, name, passWord);
message.saveChanges();
transport.sendMessage(message, message.getAllRecipients());
transport.close(); return true;
} catch (AddressException addressException) {
// addressException.printStackTrace();
return false;
} catch (MessagingException messagingException) {
// messagingException.printStackTrace();
return false;
} catch (Exception e) {
// e.printStackTrace();
return false;
}
}
/**
* 发送HTML格式的邮件
*
* @param mails
* 收件人地址组
* @param content
* 邮件正文
* @param subject
* 邮件标题
* @throws MailException
*/
public void sendHTMLMails(String[] mails, String subject, String content)
throws MailException {
MimeMessage message = sender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message, false,
"UTF-8");
StringBuffer sb = new StringBuffer();
// 解析收件人地址
if (mails != null && mails.length > 0) {
for (String m : mails) {
sb.append(m + ",");
}
helper.setTo(InternetAddress.parse(sb.toString()));
}
helper.setSubject(subject);
helper.setText(content, true); // true表示为HTML邮件
helper.setFrom(new InternetAddress(from, MimeUtility.encodeText(alias,
"UTF-8", "b")));
sender.send(message);
} catch (MessagingException e) {
throw new MailException("发送HTML格式邮件时出错,错误信息:" + e.getMessage());
} catch (UnsupportedEncodingException e) {
throw new MailException("发送HTML格式邮件时出错,错误信息:" + e.getMessage());
}
}