是在用到 
session = Session.getDefaultInstance(props, new Email_Autherticatorbean( user, password ) );带身份验证的邮件要用到的一个类 
的时候

解决方案 »

  1.   

    先不要验证好了,
    session = Session.getDefaultInstance(props, null);
      

  2.   

    是在同一个程序的不同地方用两个smtp服务器发邮件的么?
    如果是请用Session.getInstance(props,auth)
    否则会得到同一个对象
    getDefaultInstance
    public static Session getDefaultInstance(java.util.Properties props,
                                             Authenticator authenticator)
    Get the default Session object. If a default has not yet been setup, a new Session object is created and installed as the default. 
    Since the default session is potentially available to all code executing in the same Java virtual machine, and the session can contain security sensitive information such as user names and passwords, access to the default session is restricted. The Authenticator object, which must be created by the caller, is used indirectly to check access permission. The Authenticator object passed in when the session is created is compared with the Authenticator object passed in to subsequent requests to get the default session. If both objects are the same, or are from the same ClassLoader, the request is allowed. Otherwise, it is denied. Note that if the Authenticator object used to create the session is null, anyone can get the default session by passing in null. In JDK 1.2, additional security Permission objects may be used to control access to the default session.Parameters:
    props - Properties object. Used only if a new Session object is created.
    It is expected that the client supplies values for the properties listed in Appendix A of the JavaMail spec (particularly mail.store.protocol, mail.transport.protocol, mail.host, mail.user, and mail.from) as the defaults are unlikely to work in all cases.
    authenticator - Authenticator object. Used only if a new Session object is created. Otherwise, it must match the Authenticator used to create the Session.
    Returns:
    the default Session object
      

  3.   

    是同一个程序在不同的程序服务器用同一个smtp服务器发送邮件,在一个程序服务器上可以,在另一个程序服务器上不可以