当前位置: 代码迷 >> J2SE >> 用javamail写一个带正文和图片的发送邮件,在网下拷贝了代码,发现出一上异常,咋回事
  详细解决方案

用javamail写一个带正文和图片的发送邮件,在网下拷贝了代码,发现出一上异常,咋回事

热度:4696   发布时间:2013-02-25 00:00:00.0
用javamail写一个带正文和图片的发送邮件,在网上拷贝了代码,发现出一下错误,怎么回事
DEBUG: setDebug: JavaMail version 1.4.5
Exception in thread "main" java.lang.NullPointerException
at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:226)
at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:299)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1375)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021)
at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:419)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1354)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021)
at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:419)
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1354)
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2107)
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2075)
at mail.Demo3.main(Demo3.java:77)

------解决方案--------------------------------------------------------
我到网上 找了一下 可能是这个原因 你看看http://zhidao.baidu.com/question/397854324