apache 发送邮件(html)格式 ,只有附件中文乱码

快慢机 发布于 2012/03/31 11:55
阅读 1K+
收藏 0
在 windows服务器下,jetty容器,使用apache commons email 发送邮件html格式的,只有附件中文乱码,内容标题都是正常的,谁知道怎么解决啊!谢谢

以下是问题补充:

@快慢机:我已经试过了: 1.MimeUtility.encodeText(new String(name.getBytes(),"utf-8"),"utf-8","B") 2.MimeUtility.encodeText(name) 都不行啊!我快疯了 (2012/03/31 12:02)
加载中
0
一条大河波浪宽
一条大河波浪宽
你好,问下现在这个问题解决了吗?
0
jack520009
jack520009

java使用企业邮箱发送老是失败是因为什么?

/**
* 简单邮件发送
* @param toUser
* @param subject
* @param msg
*/
public static void send(String toUser, String subject,String msg) {
System.out.println("发送邮件给:" + toUser);
System.out.println("邮件主题为:" + subject);
System.out.println("邮件内容为:" + msg);
config = PropertiesFactory.getPropertiesHelper(PropertiesFile.APP);

SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.exmail.qq.com");
email.setAuthentication("sss@iduo.tv","12345");
//email.setSSL(Boolean.TRUE);
//email.setSslSmtpPort("465");
email.setCharset("UTF-8");
try {
email.addTo(toUser);
email.setFrom("sss@iduo.tv");// 必须和Authentication使用的用户相同,否则失败
email.setSubject(subject);
email.setMsg(msg);
email.send();
} catch (EmailException e) {
e.printStackTrace();
}
}


错误信息:

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.exmail.qq.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410)
at org.apache.commons.mail.Email.send(Email.java:1437)
at com.csmy.my.center.util.mail.EmailUtil.send(EmailUtil.java:44)
at com.csmy.my.center.util.mail.EmailUtil.main(EmailUtil.java:53)
Caused by: javax.mail.AuthenticationFailedException: 454 Error: authentication failed, system busy


at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:823)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:756)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1400)
... 3 more


返回顶部
顶部