本文介绍了如何在SQL Server中存储发送电子邮件FROM OUTLOOK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Sql Server中存储来自Outlook的发送邮件。我希望电子邮件和正文存储在Sql Server中。
How to store the sending email from Outlook in the Sql Server. I want email and body to be stored in Sql Server.
推荐答案
OutLook.Application oApp = new OutLook.Application();
OutLook.NameSpace oNS = (OutLook.NameSpace)oApp.GetNamespace("MAPI");
oNS.Logon(Missing.Value, Missing.Value, false, true);
foreach (OutLook.MAPIFolder folder in oNS.Folders)
{
string folderName = folder.Name;
GetFolders(folder);
}
public void GetFolders(MAPIFolder folder)
{
if (folder.Folders.Count == 0)
{
string path = folder.FullFolderPath;
if (foldersTocheck.Contains(path))
{
//GET EMAILS.....
foreach (OutLook.MailItem item in folder.Items)
{
Console.WriteLine(item.SenderEmailAddress + " " + item.Subject + "\n" + item.Body);
}
}
}
else
{
foreach (MAPIFolder subFolder in folder.Folders)
{
GetFolders(subFolder);
}
}
}
祝你好运
jeremy
good luck
jeremy
这篇关于如何在SQL Server中存储发送电子邮件FROM OUTLOOK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!