访问Outlook帐户中的邮箱可以找到电子邮件ID c#.net outlook 2013 [英] Accessing a mailbox within an outlook account find email id c#.net outlook 2013

查看:356
本文介绍了访问Outlook帐户中的邮箱可以找到电子邮件ID c#.net outlook 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,它将自动从Outlook上可用的帐户中的特定邮箱发送电子邮件 。目前,我可以通过以下方式获取帐户:





< pre lang =C#> Outlook.Application application = new Outlook.Application();
Outlook.Accounts accounts = application.Session.Accounts;







我可以通过以下方式迭代可用帐户:

foreach (Outlook.Account帐户 in accounts)
{
Console.WriteLine(account.DisplayName);
}

我的问题 如何我访问Exchange帐户中的邮箱 列表中的邮箱。让我们说帐户列表中的第一个元素

我已经阅读了一些关于访问邮箱的收件箱文件夹内容的其他问题,但我希望发送一个电子邮件项目,我稍后使用 span>所选邮箱 From字段。

感谢 任何帮助。





我尝试过:



Outlook.Application application = new Outlook.Application();

Outlook。账户账户= application.Session.Accounts;



我可以通过以下方式遍历可用账户:



foreach(帐户中的Outlook.Account帐户)

{

Console.WriteLine(account.DisplayName);

}

解决方案

您所拥有的代码只能在您的本地计算机上进行开发,当您发布到服务器时它将停止工作。 Outlook是一种桌面应用程序,由于种种原因不适合服务器端自动化,并且Microsoft不支持其自动化。如果要访问邮件数据,请使用POP3或IMAP和SMTP发送。如果帐户在Exchange中保留,则使用Exchange Web服务与其进行交互。



您无法通过尝试自动化Outlook来解决问题。


I am writing an application that will automate the sending of E-Mails from a specific mailbox within the account available on Outlook. Currently I am able to get the accounts available by doing:



Outlook.Application application = new Outlook.Application();
Outlook.Accounts accounts = application.Session.Accounts;




I can then iterate through the available accounts by doing:

foreach (Outlook.Account account in accounts)
{
    Console.WriteLine(account.DisplayName);
}

My question is: How do I access the mailboxes within an Exchange Account in the list. Lets say the first element in the accounts list.

I have read a few other questions on accessing the Inbox folder contents of a mailbox, but I am looking to send an email item I later create using the chosen mailbox in the "From" field.

Thanks for any help.



What I have tried:

Outlook.Application application = new Outlook.Application();
Outlook.Accounts accounts = application.Session.Accounts;

I can then iterate through the available accounts by doing:

foreach (Outlook.Account account in accounts)
{
Console.WriteLine(account.DisplayName);
}

解决方案

The code you have is only working because you are developing on your local machine, when you publish to a server it will stop working. Outlook is a desktop application that is not suitable for server-side automation due to numerous reasons, and its automation isn't supported by Microsoft. If you want to access mail data then use POP3 or IMAP and SMTP to send. If the account is held in Exchange then use the Exchange Web Services to interact with it.

You will not solve your problems by trying to automate Outlook.


这篇关于访问Outlook帐户中的邮箱可以找到电子邮件ID c#.net outlook 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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