收邮件时的中文转换问题 msg.setSubject(MimeUtility.encodeText("测试", "GBK", "B")); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //正文MimeBodyPart bodyPart = new MimeBodyPart() ;bodyPart.setContent( MimeUtility.encodeText(mailBody,"GBK","B"),"text/html;charset=gb2312" ) ;正文部分该怎么写,按照上面的写法会出现乱码 1.在JavaMail的api中有这些方法的说明2.试试bodyPart.setContent(mailBody, "text/html;charset=gb2312"); 我开始用的这个bodyPart.setContent(mailBody, "text/html;charset=gb2312");不过发到etang 邮箱的内容为???????如果用bodyPart.setContent( MimeUtility.encodeText(mailBody,"GBK","B"),"text/html;charset=gb2312" ) ;内容是一些大写字母怎么解决啊?谢谢, cbhyk:能不能留下你的联系方式? 试一下在接收的时候调用MimeUtility.decodeText方法解码邮件内容.看一下JavaMail的api,应该能解决的。我上不了QQ,MSN,很少收邮件([email protected]),一般都挂在MSDN上。 接收邮件的是 etang的邮件服务器啊,我没发转换啊 我用以下代码发邮件,用FoxMail收下来中文正常:String host = ...;int port = 25;String from = ...;String to = ...;Properties props = new Properties();props.put("mail.smtp.host", host);if (port != -1) props.put("mail.smtp.port", String.valueOf(port));Session session = Session.getInstance(props, null);MimeMessage msg = new MimeMessage(session);try{ msg.setFrom(new InternetAddress(from)); msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(to)); msg.setSubject("中文标题", "GB2312"); msg.setContent("中文内容", "text/html;charset=GB2312"); Transport.send(msg);}catch(Exception e){ e.printStackTrace();} java求一个panel的监听事件 韩文编码问题 怎么下载旧版本的JDK? 版式风格怎么突然变化了啊? 这个包该怎么调用啊!!!!!!???? 关于java中char,byte,short的移位操作问题 这道多线程的题目我搞不懂。。。求助 悲愤难以,代友发贴,请大家声援一下!!! 为什么将checkbox放到checkboxgroup中就变成了radio了,如果我想用真正的checkboxgroup呢? 怎么把字符串转存到数组? 急求jndi的解答 它,困了我一周了,大家帮帮我吧,在线等待,大家发表一点意见吧,
MimeBodyPart bodyPart = new MimeBodyPart() ;
bodyPart.setContent( MimeUtility.encodeText(mailBody,"GBK","B"),"text/html;charset=gb2312" ) ;
正文部分该怎么写,按照上面的写法会出现乱码
2.试试bodyPart.setContent(mailBody, "text/html;charset=gb2312");
不过发到etang 邮箱的内容为???????
如果用bodyPart.setContent( MimeUtility.encodeText(mailBody,"GBK","B"),"text/html;charset=gb2312" ) ;内容是一些大写字母
怎么解决啊?谢谢,
看一下JavaMail的api,应该能解决的。
我上不了QQ,MSN,很少收邮件([email protected]),一般都挂在MSDN上。
String host = ...;
int port = 25;
String from = ...;
String to = ...;Properties props = new Properties();
props.put("mail.smtp.host", host);
if (port != -1)
props.put("mail.smtp.port", String.valueOf(port));
Session session = Session.getInstance(props, null);
MimeMessage msg = new MimeMessage(session);
try
{
msg.setFrom(new InternetAddress(from));
msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(to));
msg.setSubject("中文标题", "GB2312");
msg.setContent("中文内容", "text/html;charset=GB2312");
Transport.send(msg);
}
catch(Exception e)
{
e.printStackTrace();
}