SMTP Mail Attachment File Remains Open

muratkarabekmuratkarabek Member Posts: 18
Hi friends,

I have a problem with smtp mail codeunit in Navision 5. I've prepared the code below. After the code executes, i try to delete the file on file system, i get an error message says: "File is already in use by Microsoft Dynamics NAV SQL...". Although the mail has already sent, the attached file remains open by Navision. Any idea?

SMTPMail is Codeunit "SMTP Mail"


SMTPMail.CreateMessage(
MailBuffer."Sender Name",
MailBuffer."Sender Address",
MailBuffer.Recipients,
MailBuffer.Subject,
MailBuffer.Body,
MailBuffer."Html Formatted");

SMTPMail.AddAttachment(AttachmentFile);
SMTPMail.Send;

Comments

Sign In or Register to comment.