public bool Match(MailItem_ID mailID)
        {
            MailItem            mail     = (MailItem)_app.Session.GetItemFromID(mailID.Value);
            string              strProp  = GetPropertyValue(Property, mail);
            Func <string, bool> comparer = GetComparer(strProp);
            bool flagResult = Validation.All(comparer);

            return(flagResult);
        }
        public void DoAction(MailItem_ID mailID)
        {
            MailItem mail = (MailItem)_app.Session.GetItemFromID(mailID.Value);

            Action <MailItem, string>[] actions = GetActions();

            foreach (Action <MailItem, string> action in actions)
            {
                action(mail, ActionArg);
            }
        }
예제 #3
0
        public void Process(Outlook.MailItem mail)
        {
            //TODO: Lock the email if possible

            try
            {
                if (mail.Sender != null)
                {
                    foreach (IRuleCriteria criteria in _criterium)
                    {
                        MailItem_ID mailID = new MailItem_ID(mail);
                        if (criteria.Match(mailID))
                        {
                            Task.Run(() => criteria.DoAction(mailID));
                        }
                    }
                }
            }
            catch (System.Exception)
            {
                throw;
            }
        }