![](/img/trans.png)
[英]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.