andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

AE.Net.Mail.Attachment.Save() method exception #204

Open alexneb opened 6 years ago

alexneb commented 6 years ago

Hi guys,

We use AE.Net.Mail to save IMAP mail attachments to specified folders. We are on the "receiving" side and recently something has changed in "sending" side . Here is how the attachment metadata now looks " Content-Type: application/octet-stream; name0="FW DEFAULT CCB_UPGRADE_V25 - Defect #165 - Cannot access th"; name1="e Bill page on a Pending Bill.msg" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename0="FW DEFAULT CCB_UPGRADE_V25 - Defect #165 - Cannot access th"; filename1="e Bill page on a Pending Bill.msg" Content-ID: <FW DEFAULT CCB_UPGRADE_V25 - Defect #165 - Cannot access the Bill page on a Pending Bill.msg> " Apparently when the name of an attachment is "too long" a "multipart" name - filename0 and filename1 is used.

In this case Attachment.Filename in AE.Net.Mail is empty and our code

attachment.Save(config.PARKED_FOLDER + "\" + subject + "\" + attachment.Filename);

results into IO exceptions in AE.Net.Mail.Attachment.Save(String filename) in c:\repos\aenetmail\Attachment.cs:line 46

I am not sure when and IF ever the situation could be fixed in "Sending" end. I need to find a workaround on my side now.

I wonder if there is any other way to get a filename in AE.Net.Mail aside of parsing e-mail body for attachment name. This approach is error prone and would use it as a last resort...

For this particular case we have the following in e-mail body -

Attachment 1 : FW DEFAULT CCB_UPGRADE_V25 - Defect #165 - Cannot access the Bill page on a Pending Bill.msg (see attachment <FW DEFAULT CCB_UPGRADE_V25 - Defect #165 - Cannot access the Bill page on a Pending Bill.msg>) Attachment 2 : Attachment 3 :

Thanks a lot for your help in advance!

Alex Nebogatov,

Montreal