Email Attachment remains locked

Hi,

I am attaching a PDF file to a message and directly after the code snippet below the PDF file remains locked until my program exits.

What am I doing wrong?

Attachment att;
att = new Attachment(sOut);
att.Name = “Advice Fees Paid.pdf”;
message.Attachments.Add(att);

Hi Greg,


Thank you for contacting Aspose support team.

I have tested your code and observed that you are not using Dispose() function for the attachment. Please modify your code as given below which releases the PDF attachment immediately.

Attachment att;
att = new Attachment(sOut);
att.Name = “Advice Fees Paid.pdf”;
message.Attachments.Add(att);
att.Dispose();//Add this line

Please feel free to write us back if you have any other query in this regard.

Hi Greg,


It is nice to know that your issue is resolved. Please feel free to write us back if you have any other query related to Aspose.Email.