同僚にメールを送信しようとしていますが、最初のメールの後、アプリケーションがクラッシュします。このメッセージが表示されます
COMException がユーザー コードによって処理されませんでした。 「アイテムは移動または削除されました。」
private void SendMail()
{
var usersEmailAddresses = Factory.Users.List(); // .List() lists all the data from the Users table.
Application OutlookApplication = new Application();
MailItem OutlookMail = (MailItem)OutlookApplication.CreateItem(OlItemType.olMailItem);
OutlookMail.Subject = @"TEST/Ushqimi i caktuar per sot";
MailBody //region, here I assign the MailBody Text.
for (int index = 0; index < usersEmailAddresses.Count; index++)
{
OutlookMail.To = usersEmailAddresses[index].Email; //Here is where I get the exception, AFTER trying to assign the second email.
if (usersEmailAddresses[index].RecieveEmail && !usersEmailAddresses[index].IsOnVacation)
{
((_MailItem)OutlookMail).Send();
}
}
}
私は何を間違っていますか?助言がありますか?