Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- }
- }
- MailItem OutlookMail = (MailItem)OutlookApplication.CreateItem(OlItemType.olMailItem);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement