解决方案 »

  1.   

    web项目调用代码如下:
    /**
     * 发送电子邮件
     * @param to 收信人
     * @param subject 主题
     * @param content 内容
     * @throws MessagingException 
     * @throws UnsupportedEncodingException 
     */
    public static void sendEmail(String to,String subject,String content) throws UnsupportedEncodingException, MessagingException{
    MailSend ms = new MailSend();
    ms.setAuth(MAIL_FROM_ACCOUNT, MAIL_PASS);
    ms.sendMail(to, null, subject, content);
    }
      

  2.   

    找到错误了,,,
     Session session = Session.getDefaultInstance(props, auth);
    由于别的代码也用了jmail发了邮件,设置过props,这里调用的就是之前设置的props了,并没有用到这里设置的这些关于QQ企业邮箱的参数,将别的地方或都这里改成: Session session = Session.getDefaultInstance(props, auth);-----》Session.getInstance