[英]Create a draft email in Outlook 365 and then open it for editing
[英]How to open outlook mail object as a draft email before sending?
void send_reply(Outlook.MailItem item, HashSet<string> names)
{
Outlook.MailItem eMail = item.Reply();
// want to open an email draft box for user to type in the email's content then return to the program here
eMail.Display();
foreach (string s in names)
{
eMail.To = s;
//MessageBox.Show("this is the guy we are sending to " + item.To);
eMail.Importance = Outlook.OlImportance.olImportanceHigh;
((Outlook._MailItem)eMail).Send();
}
}
想要向给定的邮件发送回复,但只发送到名称中指定的 email 地址。 我遇到的问题是,当我调用 eMail.Display() 时,它最多只显示半秒钟,然后草稿自动关闭,我向每个人的名字发送空白回复 email。
有人有什么建议吗?
Display()
function 立即返回并使您发送的消息为空。
您可以通过将true
传递给 function 来等待:
//...
Outlook.MailItem eMail = item.Reply();
eMail.Display(true); // <-- here
//...
这将使 window 模态并等待用户关闭它。
也许您还必须检查用户是否在没有文本的情况下关闭它或打算撤消操作......
为此,您可以检查消息状态或将处理程序注册到一个(或两个) Close
(和Send
)事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.