基于this issue,我可以在发送时将Outlook.Mailitem对象保存为文件:
..
using Outlook = Microsoft.Office.Interop.Outlook;
...
public partial class MyClass: DevExpress.XtraEditors.XtraUserControl
{
static Microsoft.Office.Interop.Outlook.MailItem mailItem;
...
public static void SendAnOutlookMail()
{
...
mailItem.Display(false);
((Outlook.ItemEvents_10_Event)mailItem).Send += new Microsoft.Office.Interop.Outlook.ItemEvents_10_SendEventHandler(ThisAddIn_Send);
...
};
static void ThisAddIn_Send(ref bool Cancel)
{
mailItem.SaveAs(@"d:\1\sent.msg");
}
...
}
我唯一的问题是,生成的文件是一个电子邮件状态只是之前发送(当我打开它时,我可以按下它上面的发送按钮)。
我的问题:如何将其保存在已发送的状态?
答案 0 :(得分:2)
您最早可以访问处于已发送状态的项目,并且已填充的发件人信息位于已发送邮件文件夹的public async Task<List<Subscriber>> GetMailChimpSubscribersAsync()
{
var subscribers = new List<Subscriber>();
var listId = "";
var members = await _manager.Members.GetAllAsync(listId);
foreach (var item in members)
{
var sub = new Subscriber();
sub.Email = item.EmailAddress;
subscribers.Add(sub);
}
return subscribers;
}
public static async Task<List<Subscriber>> GetSubscribersAsync()
{
MailchimpHelper helper = new MailchimpHelper();
return await helper.GetMailChimpSubscribersAsync();
}
事件处理程序中。