F
Ferdinand Zaubzer
I have a Problem of creating a large number of emails with attachments.
Everything works fine, but when the 100th mail is created and the
attachment is added
mail.Attachments.Add(fileName, (int)OlAttachmentType.olByValue,
mail.Body.Length + 1, "My Attachment");
throws an Exception telling me the following: (Translated from German)
The file <filename> cannot be created. Check the permissions of the
folder where you want to create the file.
The code for creating all the mails is the following:
foreach (Recipient rec in Recipients){
_MailItem mail = outlookApp.CreateItem(OlItemType.olMailItem);
mail.To = rec.address;
mail.Body = rec.body;
mail.Subject = rec.subject;
mail.Attachments.Add(rec.pathToAttachment,
(int)OlAttachmentType.olByValue,
mail.Body.Length + 1, "My Attachment");
mail.Save();
mails.Add(mail); //save mails references in an Arraylist to be
able to send them later, after checking
mails in Draftfolder.
}
Can anyone help me with this problem
Thanks
Everything works fine, but when the 100th mail is created and the
attachment is added
mail.Attachments.Add(fileName, (int)OlAttachmentType.olByValue,
mail.Body.Length + 1, "My Attachment");
throws an Exception telling me the following: (Translated from German)
The file <filename> cannot be created. Check the permissions of the
folder where you want to create the file.
The code for creating all the mails is the following:
foreach (Recipient rec in Recipients){
_MailItem mail = outlookApp.CreateItem(OlItemType.olMailItem);
mail.To = rec.address;
mail.Body = rec.body;
mail.Subject = rec.subject;
mail.Attachments.Add(rec.pathToAttachment,
(int)OlAttachmentType.olByValue,
mail.Body.Length + 1, "My Attachment");
mail.Save();
mails.Add(mail); //save mails references in an Arraylist to be
able to send them later, after checking
mails in Draftfolder.
}
Can anyone help me with this problem
Thanks