示例#1
0
        internal static void Detect()
        {
            if (!Settings.DetectOwnerEmail)
            {
                return;
            }
            IEMsgStore defStore = OutlookSession.GetDefaultMsgStore();

            if (defStore == null)
            {
                return;
            }
            string folderId = defStore.GetBinProp(MAPIConst.PR_IPM_SENTMAIL_ENTRYID);

            if (folderId == null)
            {
                return;
            }
            string storeID = defStore.GetBinProp(MAPIConst.PR_ENTRYID);

            if (storeID == null)
            {
                return;
            }
            IEFolder folder = OutlookSession.OpenFolder(folderId, storeID);

            if (folder == null)
            {
                return;
            }
            using ( folder )
            {
                ProcessFolder(folder);
            }
        }
示例#2
0
 public override bool DisplayMessage(string EntryID, string StoreID)
 {
     try
     {
         IEMsgStore msgStore = OutlookSession.OpenMsgStore(StoreID);
         if (msgStore != null)
         {
             return(msgStore.DisplayMessage(EntryID, OutlookSession.GetDefaultMsgStore()));
         }
     }
     catch (Exception exception)
     {
         ReportProblem(exception);
     }
     return(false);
 }
示例#3
0
        private bool CreateNewMessage(string subject, string body, EmailBodyFormat bodyFormat, ArrayList recipients,
                                      ArrayList attachments, bool useTemplatesInBody)
        {
            try
            {
                MailBodyFormat mailBodyFormat = MailBodyFormat.HTML;
                if (bodyFormat == EmailBodyFormat.PlainText)
                {
                    if (useTemplatesInBody && Settings.UseSignature)
                    {
                        body += "\r\n";
                        body += Settings.Signature;
                    }

                    mailBodyFormat = MailBodyFormat.PlainText;
                }
                else if (bodyFormat == EmailBodyFormat.Html)
                {
                    body = _rxHtmlComment.Replace(body, "");
                    body = "<HTML><BODY>" + body;
                    if (useTemplatesInBody && Settings.UseSignature)
                    {
                        body += "\r\n";
                        body += Settings.Signature;
                    }
                    body += "</BODY></HTML>";
                    Trace.WriteLine("HTML body for Outlook: \r\n" + body);
                }

                IEMsgStore msgStore = OutlookSession.GetDefaultMsgStore();
                if (msgStore != null)
                {
                    return(msgStore.CreateNewMessage(subject, body, mailBodyFormat, recipients,
                                                     attachments, OutlookSession.GetOutlookDefaultEncodingOut()));
                }
                else
                {
                    throw new ApplicationException("There are no default message store for outlook");
                }
            }
            catch (Exception exception)
            {
                ReportProblem(exception);
            }
            return(false);
        }
示例#4
0
 public override bool ReplyMessage(IResource mail, string EntryID, string StoreID)
 {
     try
     {
         OutlookSession.EMAPISession.SetQuoter(new ReplyQuoter(mail));
         IEMsgStore msgStore = OutlookSession.OpenMsgStore(StoreID);
         if (msgStore != null)
         {
             return(msgStore.ReplyMessage(EntryID, OutlookSession.GetDefaultMsgStore()));
         }
         return(true);
     }
     catch (Exception exception)
     {
         ReportProblem(exception);
     }
     return(false);
 }