我在我的 jsf2.0 应用程序中使用 mail1.4.3 jar 并且我正在尝试在请求新用户时发送电子邮件,如果我们发送邮件,即使我使用 text/html 发送邮件并且我的代码是
MimeMessage 消息 = 新的 MimeMessage(会话);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
StringBuilder bld = new StringBuilder();
bld.append("<h2>");
bld.append("New User Request");
bld.append(" for <FONT style='color:#4649FE;'> " + "TALON");
bld.append("</FONT></h2><br/>");
bld.append("<b>Requested By :");
bld.append("<FONT style='color:#4649FE;'>" + "Y.Sanjeeva Reddygggggggggg"
+ "</FONT></b><br/>");
bld.append("<b>Requested on :");
Date dt = new Date();
Calendar cel = new GregorianCalendar();
cel.setTime(dt);
SimpleDateFormat smpl = new SimpleDateFormat();
bld.append(smpl.format(cel.getTime()));
bld.append("<br/>");
bld.append("<b>User Name :<FONT style='color:#4649FE;'>"
+ "Sanjiv" + "</FONT></b><br/>");
bld.append("<b>Password :<FONT style='color:#4649FE;'>"
+ "Sanjiv" + "</FONT></b><br/>");
bld.append("<FONT style='color:#4649FE;'>");
message.setSubject("This is the Subject Line!");
message.setContent(bld.toString(),
"text/html" );
Transport.send(message);
System.out.println("Sent message successfully....");
谁能帮我
谢谢,桑吉夫