We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bug: Wrong Inline and Regular Attachment detection in MailMessage

I have already read your article “Differentiating between Inline and Regular Attachments”.


There is a bug when the MailMessage has been loaded using an EML-file.
In such a case the AttachmentCollection contains inline attachments also, while LinkedResourceCollection stays empty.

However Converting the MailMessage to a MapiMessage I can use the function IsInlineAttachment to detect Inline attachments correctly.


I am using Exchange Managed API to load an email from MS-Exchange, and Aspose to convert the EML from the Exchange-Server to a MSG file.


Code Snippet
  1. // Item id for Exchange Managed API to get an email
  2. ItemId itemId = new ItemId("AAMkADI4NjdhNzMwLThlYzItNGM0Yy1hOWRkLTU4ZmEwNTFkM2Y1YQBGAAAAAAASVodBOageT7SEJ8Ro+rgUBwCPd/2wYi7ZSKyqyPs5LaM8AAAAyj3PAACPd/2wYi7ZSKyqyPs5LaM8AAAA9WHaAAA=");
  3. // Get Email from Exchange Server
  4. EmailMessage serverMail = EmailMessage.Bind(exchangeService, itemId);
  5. // Populate serverMail with MimeContent, Id, DateTimeReceveived
  6. serverMail.Load(new PropertySet(ItemSchema.MimeContent, ItemSchema.Id, ItemSchema.DateTimeReceived));
  7. Aspose.Email.Mail.MailMessage mailMessage = null;
  8. using (MemoryStream ms = new MemoryStream(serverMail.MimeContent.Content))
  9. {
  10. // Mail message, with inline attachments also in Attachment-Collection
  11. mailMessage = Aspose.Email.Mail.MailMessage.Load(ms);
  12. }
  13. // Convert MailMessage to Mapi Message
  14. Aspose.Email.Outlook.MapiMessage mapiMessage = Aspose.Email.Outlook.MapiMessage.FromMailMessage(mailMessage);
  15. foreach (var attachment in mapiMessage.Attachments)
  16. {
  17. if (IsInlineAttachment(attachment, mapiMessage.BodyType))
  18. {
  19. // Is Inline Attachment
  20. }
  21. else
  22. {
  23. // Is Regular Attachment
  24. }
  25. }

Hi Markus,

Thank you for contancting Aspose support team.

This issue needs more analysis, therefore could you please share the sample EML file with us. It will help us to re-produce the scenario here and provide assistance accordingly.

Sorry for my late reply, I was on vacation the last two weeks.


In the attachment you can find a .eml file, where the inline attachment is not detected as inline.

kind regards
Markus

Hi Markus,


Thank you for providing sample EML file. I have analyzed it and observed that it shows two attachments instead of one when loaded into MailMessage. This issue is logged in our issue tacking system under ID: EMAILNET-35013 for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.



Hi Markus,

Our product team has investigated the issue logged as EMAILNET-35013 and found it not a bug at our end. The image in the message body, “log_hilti.gif” has content-disposition as Attachment and that is why it is interpreted as attachment.

I do not agree.


* Using Aspose-MapiMessage your code for Differentiating between Inline and Regular Attachments (http://www.aspose.com/docs/display/emailnet/Differentiating+between+Inline+and+Regular+Attachments)
tells me that there is one “regular” and one “inline” attachment.

* According to MailMessage there are two regular Attachments, and no Inline-Attachments.

(so either Aspose-MapiMessage or Aspose-MailMessage is wrong)


* By the way, Outlook shows only one “regular” Attachment. - That is the reason I expect Aspose MailMessage to also show only one regular Attachment.
(I suggest to change your algorithm to detect Inline an Regular Attachments to behave the same way Outlook does).

kind regards
Markus

Hi Markus,


We have requested our Product team to further share their feedback about your inquiry. As soon as there is some information available about this issue, we shall update you here.

The issues you have found earlier (filed as EMAILNET-35013) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.