Alternate view is deleted when message is sent or saved, when message also contains linked resources

Alternate view is deleted when message is sent or saved, when message also contains linked resources.

When message is loaded from disk text/plain alternate view is still there.
After message is sent the alternate view is gone.
SMTP logging also shows that the alternate view is not sent.

When message is saved initially, alternate views and linked resources are saved.
When message is loaded, alternate view is still there.
When load message is saved again, the alternate view is gone.

When message does not contain any linked resources, the alternate view is not deleted when saved.

Expected behaviour:
Alternate view must not be deleted.
Alternate view must be sent.
Alternate view must be saved

Tested with Aspose.Email Version 21.2.0

Demo program to demonstrate behaviour:
.TestAlternateView.zip (6.3 KB)

@hromkes,
Thank you for the issue description. I have logged the issue in our tracking system with ID EMAILNET-40169 to investigate further. I will inform you about any progress.

I did some additional testing and investigation with attachments.
When I add an attachment it seems to work fine and alternate views are not deleted.

Further, I found out that the message is build up from different parts, which can be nested:

  • multipart/mixed
  • multipart/alternative
  • multipart/related

When outer part is mixed
(this is the case when attachment is added), it seems to work fine.
Alternate views are not removed.

When the structure is:

multipart/alternative
–Text Part
–HTML part (multipart/related)
----HTML contents
----Embedded images

It seems to work fine.
To build this structure, linked resources were added to the alternate view (html part) and removed at message level.
A disadvantage is that the linked resources are not visible at message level.
A strange thing is that all parts are separated by the same boundary.
I don’t know whether this matters, but I expected that for nested parts a different boundary would be used.

When structure is :

multipart/related
–Message part (multipart/alternative)
----Text contents
----HTML contents
–Embedded images

The part containing the text contents is removed.

When an attachment is added to the last example, the text contents are not removed.

I hope this information helps solving this problem quickly.

@hromkes,
Thank you for the additional information. We will take it into account for investigating the issue.

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