将电子邮件移至 SQL 服务器
Move emails to SQL Server
我想在 .net 中编写一个应用程序,它将扫描邮箱并将新项目放入 SQL 服务器数据库。
只是想知道实现此目标的最佳方法是 API。有没有我可以使用的特定于交易所或第三方的。
能够在单独的字段中保存 To/From/CC、标题、电子邮件 Body 和其他元数据对我来说很重要。
谢谢
查看 .net 中的 ExchangeService
。您可以连接到 Exchange 服务器并执行各种魔术。
您还需要将 Microsoft.Exchange.WebServices
和 Microsoft.Exchange.WebServices.Auth
程序集添加到您的项目中
这样使用
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
// Setting credentials is unnecessary when you connect from a computer that is
// logged on to the domain.
service.Credentials = new WebCredentials(sUserName, sPassword, sDomain);
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
service.Url = new Uri(lsRootUri);
Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
inbox.Load();
ItemView iv = new ItemView(50);
FindItemsResults<Microsoft.Exchange.WebServices.Data.Item> emails = inbox.FindItems(iv);
foreach (Microsoft.Exchange.WebServices.Data.Item email in emails)
{
}
除非你真的想自己写,否则这个产品应该做你想做的:
不便宜,但功能似乎很齐全。
我想在 .net 中编写一个应用程序,它将扫描邮箱并将新项目放入 SQL 服务器数据库。
只是想知道实现此目标的最佳方法是 API。有没有我可以使用的特定于交易所或第三方的。
能够在单独的字段中保存 To/From/CC、标题、电子邮件 Body 和其他元数据对我来说很重要。
谢谢
查看 .net 中的 ExchangeService
。您可以连接到 Exchange 服务器并执行各种魔术。
您还需要将 Microsoft.Exchange.WebServices
和 Microsoft.Exchange.WebServices.Auth
程序集添加到您的项目中
这样使用
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
// Setting credentials is unnecessary when you connect from a computer that is
// logged on to the domain.
service.Credentials = new WebCredentials(sUserName, sPassword, sDomain);
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
service.Url = new Uri(lsRootUri);
Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
inbox.Load();
ItemView iv = new ItemView(50);
FindItemsResults<Microsoft.Exchange.WebServices.Data.Item> emails = inbox.FindItems(iv);
foreach (Microsoft.Exchange.WebServices.Data.Item email in emails)
{
}
除非你真的想自己写,否则这个产品应该做你想做的:
不便宜,但功能似乎很齐全。