Attachment Saving Exceptions

Jan 15, 2010 at 8:56 PM

The method InterIMAP.Asynchronous.Client.IMAPMailboxManager.SaveAttachment() uses a filestream object to save to a location. There are a ton of different exceptions that can arise from using FileStream objects to save attachments, which should be handled. One example is permissions. The program may not have permission to save to a particular folder, even if the user does.

Mar 26, 2010 at 1:01 PM
Thank you for bringing that up. When i originally wrote the SaveAttachment method, i was mainly using it to test the message part processing to make sure the binary data that was being decoded was correct. In production environments i agree it is vital to catch any of the possible exceptions that can occur with the FileStream object and handle them appropriately. However, i feel that handling some of those exceptions should be the responsibility of the client program as different exceptions can mean different things in different contexts. So my recommendation would be to try/catch each call the SaveAttachment in your client code and handle the exceptions in the appropriate way.