阅读电子邮件没有Outlook应用程序开放 [英] Reading e-mail without Outlook app open

查看:155
本文介绍了阅读电子邮件没有Outlook应用程序开放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我使用使用C#阅读电子邮件的内容:

Thats what I am using to read e-mail using C#:

outLookApp.NewMailEx += new ApplicationEvents_11_NewMailExEventHandler(outLookApp_NewMailEx);
            Outlook.NameSpace olNameSpace = outLookApp.GetNamespace("mapi");

olNameSpace.Logon("xxxx", "xxxxx", false, true);
Outlook.MAPIFolder oInbox  = olNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Items oItems  = oInbox.Items;
MessageBox.Show("Total : " + oItems.Count); //Total Itemin inbox
 oItems = oItems.Restrict("[Unread] = true");
 MessageBox.Show("Total Unread : " + oItems.Count); //Unread Items
 Outlook.MailItem oMsg;


 Outlook.Attachment mailAttachement;
 for (int i = 0; i < oItems.Count; i++)
 {
     oMsg = (Outlook.MailItem)oItems.GetFirst();

     MessageBox.Show(i.ToString());

    MessageBox.Show(oMsg.SenderName);
    MessageBox.Show(oMsg.Subject);
    MessageBox.Show(oMsg.ReceivedTime.ToString());
    MessageBox.Show(oMsg.Body);

这是我面临的问题是,这个应用程序只如果Outlook是在机器上打开的工作。如果Outlook关闭它抛出一个异常:

The problem that I am facing is this application only works if the Outlook is open on the machine. If Outlook is closed it throws an exception:

服务器不可用。如果这种情况持续存在,请与管理员联系。

The server is not available. Contact your administrator if this condition persists.

反正是有,我可以阅读电子邮件与Outlook打开?

Is there anyway I can read e-mail with Outlook open?

推荐答案

您很可能会碰到的这个当Outlook被关闭。

You'll likely run into this when Outlook is closed.

也是继的本教程将确保你做所有正确的步骤组成部分。

Also following this tutorial will ensure you're doing all the right steps part and parcel.

祝你好运!

这篇关于阅读电子邮件没有Outlook应用程序开放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆