即使在发送后,以编程方式为 Outlook 生成的电子邮件也会卡在草稿文件夹中!
因此,我一直通过 C# 应用程序为我工作的公司生成电子邮件。电子邮件生成得很好。唯一的小问题是,当它们从草稿文件夹发送时,它们不会移动到已发送文件夹。它们保留在草稿文件夹中。
我不知道这是否是电子邮件上的设置
这是我使用的代码:
Outlook.Application objOutlook= new Outlook.Application();
// Creating a new Outlook Message from the Outlook Application Instance
// Assigns the "TO", "CC" and "BCC" Fields
// Assigns the Subject Field
Outlook._NameSpace oNameSpace = objOutlook.GetNamespace("MAPI");
Outlook.MAPIFolder folder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
String body;
Outlook.MailItem mic = (Outlook.MailItem)(objOutlook.CreateItem(Outlook.OlItemType.olMailItem));
mic.To = receiver;
//Code that fills in body and what not of the email
mic.Subject = subject;
mic.HTMLBody = body;
mic.SaveSentMessageFolder = folder
mic.Save();
也许有人有想法?感谢您的帮助!
So I have been generating emails through a C# application for the company I work for. Emails are generated fine. The only little issue is that when they are sent from the drafts folder, they are not moved to the sent folder. They stay in the drafts folder.
I didnt know if it was a setting on the email or not
Here is the code I used:
Outlook.Application objOutlook= new Outlook.Application();
// Creating a new Outlook Message from the Outlook Application Instance
// Assigns the "TO", "CC" and "BCC" Fields
// Assigns the Subject Field
Outlook._NameSpace oNameSpace = objOutlook.GetNamespace("MAPI");
Outlook.MAPIFolder folder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);
String body;
Outlook.MailItem mic = (Outlook.MailItem)(objOutlook.CreateItem(Outlook.OlItemType.olMailItem));
mic.To = receiver;
//Code that fills in body and what not of the email
mic.Subject = subject;
mic.HTMLBody = body;
mic.SaveSentMessageFolder = folder
mic.Save();
Maybe some one has a idea? Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信它在发送后将电子邮件保存在草稿文件夹中,因为您要求它将其保存在那里。
根据 MSDN:
I believe it is saving the emails in the Drafts folder after being sent because you asked it to save it there.
Per MSDN: