Hi,
I'm experiencing file handles being left open when creating a new MailMessage to send via SMTP and attaching files. I'm attaching them to the MailMessage like so (they are PDFs in this case, I haven't tested with other files):
===========================
For Each fp As FileRef In mFiles
msg.AddAttachment(New Aspose.Network.Mail.Attachment(fp.Path))
Next
'FileRef is defined as a structure like this:
Public Structure FileRef
Public ID As String
Public Path As String
Public Sub New(ByVal path As String, ByVal id As String)
Me.ID = id
Me.Path = path
End Sub
End Structure
===========================
I went to delete the PDF files (because they are being generated by SQL reporter and Aspose.PDF, 2 separate files) while my application was still running and it told me they could not be deleted because they were in use.
They weren't both created the same way, so I found this as odd behavior. If anything I thought I was closing my Facades.Form object incorrectly, but the SQL reporter PDF (which has no connection to Aspose) was also giving the error message.
I commented out the line that attached my PDF files to the email and let the emails send without any attachments. While the application was still running, I was able to delete the file without any issue.
I am currently using Aspose.Network 6.4.0.0. I see that the namespace has changed to Aspose.Email. Has this issue been addressed or am I doing something incorrectly here? Obviously I can update, but I would like to know if this was fixed in the latest version.
Also, for async sends, do I need to worry about calling Dispose on the MailMessage object (inside the callback) and its attachments at all? I don't see any information about object clean up in the documentation.
Thank you.