要设置smtp之类的吧?再上网搜索看看吧

解决方案 »

  1.   

    msg.setContent(message.getText(), "GBK");
    这个message是个什么东东,自己打印一下试试
      

  2.   

    应该是配置文件有问题了。
    javax.mail.internet.ParseException: Expected '/', got null
    说明在读取配置信息的时候,你为空了,或者该项没有配置。
      

  3.   

    props.put("mail.smtp.host","smtp.qq.com");//设置邮件服务器的域名或IP
      

  4.   

    private String host = "smtp.qq.com";
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.auth", "true");
    Authenticator auth = new Email_Autherticator();
    Session session = Session.getInstance(props, auth);
      

  5.   

    呃……貌似快两个月前的帖子了……
    应该问题解决了吧……不过看了下,貌似回帖里面没有正确答案……
    补上好了……Expected '/', got null
    异常,是因为
    msg.setContent(message.getText(), "GBK");
    这个"GBK"引起的……
    要写成MIME那种形式——"text/html;charset=GBK"PS:不知道这个message是神马,不过看起来getText()方法像返回了个字符串……
    话说,这里不包装成MimeMultipart神马的真的没问题么?最后,附上段APIsetContentpublic void setContent(Object o,
                           String type)
                    throws MessagingException
    A convenience method for setting this Message's content.
    The content is wrapped in a DataHandler object. Note that a DataContentHandler class for the specified type should be available to the JavaMail implementation for this to work right. i.e., to do setContent(foobar, "application/x-foobar"), a DataContentHandler for "application/x-foobar" should be installed. Refer to the Java Activation Framework for more information.Specified by:
    setContent in interface Part
    Parameters:
    o - the content object
    type - Mime type of the object
    Throws:
    IllegalWriteException - if the underlying implementation does not support modification of existing values
    IllegalStateException - if this message is obtained from a READ_ONLY folder.
    MessagingException
      

  6.   

    //填写邮件相关信息(主题、正文、发件人地址)
    message.setSubject("---订单支付成功邮件-----");
    message.setContent("订单号*************已经支付成功","text/html;charset=utf-8");