一般用session.getInstance(properties,Authenticator)

解决方案 »

  1.   

    session.getInstance(properties,Authenticator)是常见一些,
    可另一种Transport.connect(smtpHost,user,password)看起来也不是不可以啊。
      

  2.   

    try{
          mimeMsg.setContent(mp);
          mimeMsg.saveChanges();
          Session mailSession = Session.getInstance(props,null);//1
          Transport transport = mailSession.getTransport("smtp");
          transport.connect((String)props.get("mail.smtp.host"),mailuser,mailpassword);//2
          transport.sendMessage(mimeMsg,mimeMsg.getAllRecipients());
          if (sendlog!=null)
           sendlog.println("Mail Successfully Sended!");
          transport.close();
     }
     catch(Exception e)
     {
          if (sendlog!=null)
           sendlog.println(e.getMessage());;
          return false ;
     }