开发者

Redemption to Process Incoming Email in C#

开发者 https://www.devze.com 2023-03-18 22:14 出处:网络
I am working to process the incoming email received from exchange server. Previously I used NewMailEx to fire for incoming mails. But this works only when Outlook is online. I need to make it to work

I am working to process the incoming email received from exchange server. Previously I used NewMailEx to fire for incoming mails. But this works only when Outlook is online. I need to make it to work even when Outlook is offline.

So I am now moving on to the powerful tool called Redemption. But I can't get started here.

My previous code is for your reference.

 pr开发者_Go百科ivate void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
    _Explorers = this.Application.Explorers;
    _Inspectors = this.Application.Inspectors;

    _Explorers.Application.NewMailEx += new
    Outlook.ApplicationEvents_11_NewMailExEventHandler(Application_NewMailEx);
    outlookNamespace = this.Application.GetNamespace("MAPI");
  }

  private void Application_NewMailEx(string EntryID)
  {
    Outlook.MailItem newMail = (Outlook.MailItem)_Explorers.Application.Session.GetItemFromID(
    EntryID, System.Reflection.Missing.Value);
  }

How can I get the body of an incoming email through redemption? Or is there any other way to fire incoming messages even when outlook is offline.

I am using Outlook 2007 and Microsoft Exchange Server and developing using Visual Studio 2010.


You can also use Items.ItemAdd event on the Inbox folder. RDOSession.NewMailEx won't fire either when you are offline - this is just how MAPI works. NewMail event fires when a message arrives. When a new item is synchronized from the server, only Items.ItemAdd event will fire on the parent folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消