查了一下smtp.jar的代码只有这里有这个输出,可是我已经设置了 mail.debug=false,而且就算是debug打开了也不应该是只有QUIT的时候才有debug输出,其他debug信息都没有输出,就算setDebugOutput设置成其他Stream也没用,它硬是要打印到我的stdout上面,不定期神经质出现,各位大侠helppublic synchronized void close()
    throws MessagingException
  {
    if (!(super.isConnected()))
      return;
    try {
      if (this.serverSocket != null) {
        sendCommand("QUIT");
        if (this.quitWait) {
          int resp = readServerResponse();
          if ((resp != 221) && (resp != -1) && (this.debug))
            this.out.println("DEBUG SMTP: QUIT failed with " + resp);
        }
      }
    } finally {
      closeConnection();
    }
  }

解决方案 »

  1.   

    这个只有3个可能1. 你机器里面有些什么不好的东西 病毒啊 什么的
    2. 试试看把杀毒软件关掉  特别是瑞星 if you are using it.
    3. 试试看把路由器的防火墙关掉
      

  2.   

    关闭瑞星等监控软件
    http://fluagen.blog.51cto.com/146595/34696
      

  3.   

         Properties p = new Properties();
            p.put("mail.host", smtpServerDns);
            p.put("mail.smtp.auth", String.valueOf(authFlag));
            MailAuthenticator author = new MailAuthenticator(user, password);
            session = Session.getInstance(p, author);
            session.setDebugOut(xxxxxx);
            session.setDebug(true);
           
    应该可以打出东西来的,几年前的版本都可以,1.4应该都没问题吧, 不过好想新版本连附件的信息都会打出来,想做回调打印进度什么不友好/*      */ package javax.mail;
    /*      */ 
    /*      */ import com.sun.mail.util.LineInputStream;
    /*      */ import java.io.BufferedInputStream;
    /*      */ import java.io.File;
    /*      */ import java.io.FileInputStream;
    /*      */ import java.io.FileNotFoundException;
    /*      */ import java.io.IOException;
    /*      */ import java.io.InputStream;
    /*      */ import java.io.PrintStream;
    /*      */ import java.lang.reflect.Constructor;
    /*      */ import java.net.InetAddress;
    /*      */ import java.net.URL;
    /*      */ import java.security.AccessController;
    /*      */ import java.security.PrivilegedAction;
    /*      */ import java.security.PrivilegedActionException;
    /*      */ import java.security.PrivilegedExceptionAction;
    /*      */ import java.util.Enumeration;
    /*      */ import java.util.Hashtable;
    /*      */ import java.util.Properties;
    /*      */ import java.util.StringTokenizer;
    /*      */ import java.util.Vector;
    /*      */ 
    /*      */ public final class Session
    /*      */ {
    /*      */   private final Properties props;
    /*      */   private final Authenticator authenticator;
    /*  186 */   private final Hashtable authTable = new Hashtable();
    /*  187 */   private boolean debug = false;
    /*      */   private PrintStream out;
    /*  189 */   private final Vector providers = new Vector();
    /*  190 */   private final Hashtable providersByProtocol = new Hashtable();
    /*  191 */   private final Hashtable providersByClassName = new Hashtable();
    /*  192 */   private final Properties addressMap = new Properties();
    /*      */ 
    /*  195 */   private static Session defaultSession = null;
    /*      */ 
    /*      */   private Session(Properties props, Authenticator authenticator)
    /*      */   {
    /*  199 */     this.props = props;
    /*  200 */     this.authenticator = authenticator;
    /*      */ 
    /*  202 */     if (Boolean.valueOf(props.getProperty("mail.debug")).booleanValue()) {
    /*  203 */       this.debug = true;
    /*      */     }
    /*  205 */     if (this.debug) {
    /*  206 */       pr("DEBUG: JavaMail version 1.4.2");
    /*      */     }
    /*      */ 
    /*  210 */     if (authenticator != null)
    /*  211 */       cl = authenticator.getClass();
    /*      */     else {
    /*  213 */       cl = super.getClass();
    /*      */     }
    /*  215 */     loadProviders(cl);
    /*  216 */     loadAddressMap(cl);
    /*      */   }
    /*      */ 
    /*      */   public static Session getInstance(Properties props, Authenticator authenticator)
    /*      */   {
    /*  237 */     return new Session(props, authenticator);
    /*      */   }
    /*      */ 
    /*      */   public static Session getInstance(Properties props)
    /*      */   {
    /*  254 */     return new Session(props, null);
    /*      */   }
    /*      */ 
    /*      */   public static synchronized Session getDefaultInstance(Properties props, Authenticator authenticator)
    /*      */   {
    /*  303 */     if (defaultSession == null) {
    /*  304 */       defaultSession = new Session(props, authenticator);
    /*      */     }
    /*  307 */     else if (defaultSession.authenticator != authenticator)
    /*      */     {
    /*  309 */       if ((defaultSession.authenticator == null) || (authenticator == null) || (defaultSession.authenticator.getClass().getClassLoader() != authenticator.getClass().getClassLoader()))
    /*      */       {
    /*  316 */         throw new SecurityException("Access to default session denied");
    /*      */       }
    /*      */     }
    /*  319 */     return defaultSession;
    /*      */   }
    /*      */ 
    /*      */   public static Session getDefaultInstance(Properties props)
    /*      */   {
    /*  344 */     return getDefaultInstance(props, null);
    /*      */   }
    /*      */ 
    /*      */   public synchronized void setDebug(boolean debug)
    /*      */   {
    /*  363 */     this.debug = debug;
    /*  364 */     if (debug)
    /*  365 */       pr("DEBUG: setDebug: JavaMail version 1.4.2");
    /*      */   }
    /*      */ 
    /*      */   public synchronized boolean getDebug()
    /*      */   {
    /*  374 */     return this.debug;
    /*      */   }
    /*      */ 
    /*      */   public synchronized void setDebugOut(PrintStream out)
    /*      */   {
    /*  388 */     this.out = out;
    /*      */   }
    /*      */ 
    /*      */   public synchronized PrintStream getDebugOut()
    /*      */   {
    /*  399 */     if (this.out == null) {
    /*  400 */       return System.out;
    /*      */     }
    /*  402 */     return this.out;
    /*      */   }
    /*      */ 
    /*      */   public synchronized Provider[] getProviders()
    /*      */   {
    /*  413 */     Provider[] _providers = new Provider[this.providers.size()];
    /*  414 */     this.providers.copyInto(_providers);
    /*  415 */     return _providers;
    /*      */   }
    /*      */ 
    。。
    /* 1074 */         pr("DEBUG: " + sex);
    /*      */       }
    /*      */     } finally {
    /*      */       try {
    /* 1078 */         if (clis != null)
    /* 1079 */           clis.close();
    /*      */       }
    /*      */       catch (IOException ex)
    /*      */       {
    /*      */       }
    /*      */     }
    /*      */   }
    /*      */ 
    /*      */   private void loadResource(String name, Class cl, StreamLoader loader) {
    /* 1088 */     InputStream clis = null;
    /*      */     try {
    /* 1090 */       clis = getResourceAsStream(cl, name);
    /* 1091 */       if (clis != null) {
    /* 1092 */         loader.load(clis);
    /* 1093 */         if (this.debug) {
    /* 1094 */           pr("DEBUG: successfully loaded resource: " + name);
    /*      */         }
    。。
      

  4.   

    O no,我也出现这个问题啊,那个知道啊