Esempio n. 1
0
 public void CheckMailBox(string mailBox)
 {
     try
     {
         mailbox = clientImap.SelectMailbox(mailBox);
     }
     catch
     {
         clientImap.CreateMailbox(mailBox);
         mailbox = clientImap.SelectMailbox(mailBox);
     }
 }
Esempio n. 2
0
        public void GetMailbox(Property[] inputs, RequiredProperties required, Property[] returns, MethodType methodType, ServiceObject serviceObject)
        {
            serviceObject.Properties.InitResultTable();
            Helper h = new Helper(serviceBroker);

            try
            {
                using (var ic = h.GetImapClient())
                {
                    string mailbox = string.Empty;
                    if (serviceObject.Methods[0].Name.Equals("getmailbox"))
                    {
                        mailbox = inputs.Where(p => p.Name.Equals("name")).FirstOrDefault().Value.ToString();
                    }
                    else
                    {
                        mailbox = "INBOX";
                    }


                    AE.Net.Mail.Imap.Mailbox mb = ic.SelectMailbox(mailbox);

                    returns.Where(p => p.Name.Equals("name")).FirstOrDefault().Value                   = mb.Name;
                    returns.Where(p => p.Name.Equals("numberofmessages")).FirstOrDefault().Value       = mb.NumMsg;
                    returns.Where(p => p.Name.Equals("numberofnewmessages")).FirstOrDefault().Value    = mb.NumNewMsg;
                    returns.Where(p => p.Name.Equals("numberofunseenmessages")).FirstOrDefault().Value = mb.NumUnSeen;
                    returns.Where(p => p.Name.Equals("iswritable")).FirstOrDefault().Value             = mb.IsWritable;

                    ic.Disconnect();
                }
            }
            catch (Exception ex)
            {
                serviceObject.Properties.BindPropertiesToResultTable();
            }
            serviceObject.Properties.BindPropertiesToResultTable();
        }