日期:2014-05-18  浏览次数:20624 次

怎样得到未读邮件的个数!我只要得到未读邮件的个数就行了!怎么弄!
我在javamail的demo中找到了这个程序我直接抄了下来可是运行有错!
package   testThinking;
import   java.util.*;
import   java.io.*;
import   javax.mail.*;
import   javax.mail.internet.*;
import   javax.activation.*;

/*
  *   Demo   app   that   exercises   the   Message   interfaces.
  *   Access   message   given   its   UID.
  *   Show   information   about   and   contents   of   messages.
  *
  *   @author   John   Mani
  *   @author   Bill   Shannon
  */

public   class   MailTest   {

        static   String   protocol= "pop3 ";
        static   String   host   =   "....... ";
        static   String   user   =   "test ";
        static   String   password   =   "test ";
        static   String   mbox   =   "INBOX ";
        static   String   url   =   null;
        static   boolean   verbose   =   false;

        public   static   void   main(String   argv[])   {
long   uid   =   -1;
int   optind;

for   (optind   =   0;   optind   <   argv.length;   optind++)   {
        if   (argv[optind].equals( "-T "))   {
protocol   =   argv[++optind];
        }   else   if   (argv[optind].equals( "-H "))   {
host   =   argv[++optind];
        }   else   if   (argv[optind].equals( "-U "))   {
user   =   argv[++optind];
        }   else   if   (argv[optind].equals( "-P "))   {
password   =   argv[++optind];
        }   else   if   (argv[optind].equals( "-v "))   {
verbose   =   true;
        }   else   if   (argv[optind].equals( "-f "))   {
mbox   =   argv[++optind];
        }   else   if   (argv[optind].equals( "-L "))   {
url   =   argv[++optind];
        }   else   if   (argv[optind].equals( "-- "))   {
optind++;
break;
        }   else   if   (argv[optind].startsWith( "- "))   {
System.out.println( "Usage:   uidmsgshow   [-L   url]   [-T   protocol]   [-H   host]   [-U   user]   [-P   password]   [-f   mailbox]   [uid]   [-v] ");
System.exit(1);
        }   else   {
break;
        }
}

                try   {
        if   (optind   <   argv.length)
                  uid   =   L