Example #1
0
        public IMAPShell(IMAPConfig config, bool autoConnect)
        {
            _config        = config;
            _client        = new IMAPAsyncClient(config, 5);
            _currentFolder = null;
            _autoConnect   = autoConnect;

            InitCommandMap();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MoveMessageRequest"/> class.
        /// </summary>
        /// <param name="client">The imap client.</param>
        public MoveMessageRequest(IMAPAsyncClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            this._client = client;
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "Getting folder list...";
            IMAPConfig config = new IMAPConfig(@"c:\test1.cfg");

            client = new IMAPAsyncClient(config, 5);
            //IMAPConnectionPool.GetInstance().StartUp(config, 5);
            client.Start();
            client.RequestManager.SubmitRequest(new FolderTreeRequest("\"\"", FolderTreeCallback), false);
            button1.Enabled = false;
            button2.Enabled = true;
        }
Example #4
0
        private List <Note> GetMailList(string server, string username, string password, string notefolder)
        {
            List <Note> noteList = new List <Note>();

            if (cancelled)
            {
                return(noteList);
            }

            IMAPConfig config = new IMAPConfig(server, username, password, true, true, "/");

            client = new IMAPAsyncClient(config, 2);
            if (client.Start(false) == false)
            {
                cancelled = true;
                return(noteList);
            }

            GetMailsListRecursive(notefolder, ref noteList);

            return(noteList);
        }
Example #5
0
 /// <summary>
 /// Create a new NewMessageRequest
 /// </summary>
 /// <param name="client"></param>
 public NewMessagesRequest(IMAPAsyncClient client)
 {
     _client   = client;
     _criteria = new SearchCriteria(true);
 }
 /// <summary>
 /// Create new full message request
 /// </summary>
 /// <param name="client"></param>
 /// <param name="msg"></param>
 public FullMessageRequest(IMAPAsyncClient client, IMessage msg)
 {
     _msg    = msg;
     _client = client;
 }
 public MessageViewer(IMessage msg, IMAPAsyncClient client)
 {
     InitializeComponent();
     _client = client;
     _msg    = msg;
 }
Example #8
0
 /// <summary>
 /// Create a new Folder object with the specified ID
 /// </summary>
 /// <param name="id"></param>
 /// <param name="client"></param>
 public Folder(IMAPAsyncClient client, int id)
 {
     _id     = id;
     _client = client;
 }
Example #9
0
 /// <summary>
 /// Create a new Contact object with the specified ID
 /// </summary>
 /// <param name="id"></param>
 /// <param name="client"></param>
 public Contact(IMAPAsyncClient client, int id)
 {
     _id     = id;
     _client = client;
 }
Example #10
0
        static void Main(string[] args)
        {
            IMAPConfig config = new IMAPConfig("imap.gmail.com", "atmospherian", "Xr3pr1s3Y", true, true, "");

            config.SaveConfig(@"c:\settings.cfg");
            //IMAPConfig config = new IMAPConfig(@"c:\test1.cfg");
            IMAPAsyncClient client = new IMAPAsyncClient(config, 5);

            client.MailboxManager.CreateNewMailbox(@"c:\test.mbx");


            client.Start();
            FolderTreeRequest ftr = new FolderTreeRequest("\"\"", null);

            client.RequestManager.SubmitAndWait(ftr, false);

            IBatchRequest batch = new SimpleBatchRequest();

            foreach (IFolder folder in client.MailboxManager.GetAllFolders())
            {
                FolderDataRequest fdr = new FolderDataRequest(folder, null);
                fdr.RequestCompleted += delegate(IRequest req)
                {
                    FolderDataProcessor fdp = req.GetProcessorAsType <FolderDataProcessor>();
                    IFolder             f   = fdp.Request.Command.ParameterObjects[0] as IFolder;
                    Console.WriteLine("Data for {0} loaded. {1} Messages found.", f.Name, f.Exists);
                };
                batch.Requests.Add(fdr);
            }

            client.RequestManager.SubmitBatchAndWait(batch, false);
            batch.Requests.Clear();
            foreach (IFolder folder in client.MailboxManager.GetAllFolders())
            {
                MessageListRequest mlr = new MessageListRequest(folder, null);
                mlr.RequestCompleted += delegate(IRequest req)
                {
                    MessageListProcessor fdp = req.GetProcessorAsType <MessageListProcessor>();
                    IFolder f = fdp.Request.Command.ParameterObjects[0] as IFolder;
                    Console.WriteLine("Message List for {0} loaded. {1} Messages found.", f.Name, f.Exists);
                };

                batch.Requests.Add(mlr);
            }

            client.RequestManager.SubmitBatchAndWait(batch, false);

            client.MailboxManager.DownloadEntireAccount(delegate(int messagesCompleted, int totalMessages, IFolder currentFolder)
            {
                Console.WriteLine();
                Console.WriteLine("Message {0} of {1} downloaded from {2}", messagesCompleted, totalMessages, currentFolder.Name);
            }, delegate(int totalFolders, int totalMessages, long totalTime)
            {
                Console.WriteLine("{0} Messages in {1} folders downloaded in {2} minutes.", totalMessages, totalFolders, new TimeSpan(totalTime).Minutes);
            });


            //config.CacheFi

            Console.WriteLine("Press any key");
            Console.ReadLine();



            client.Stop();
        }
Example #11
0
 /// <summary>
 /// Create a new data manager for the specified client
 /// </summary>
 /// <param name="client"></param>
 public DataManager(IMAPAsyncClient client)
 {
     _client  = client;
     _lockObj = new object();
 }
Example #12
0
 /// <summary>
 /// Create a new content object. The ID must already exist in the content table
 /// </summary>
 /// <param name="client"></param>
 /// <param name="contentID"></param>
 public MessageContent(IMAPAsyncClient client, int contentID)
 {
     _client = client;
     _id     = contentID;
 }
Example #13
0
 /// <summary>
 /// Create a Message object with the specified ID
 /// </summary>
 /// <param name="id"></param>
 /// <param name="client"></param>
 public Message(IMAPAsyncClient client, int id)
 {
     _id     = id;
     _client = client;
 }