It is to inform you that the issue which you are facing is actually not a bug in Aspose.Email. So, we have closed this issue (EMAILNET-40811) as ‘Not a Bug’.
The IsEmbeddedMessage property is true when the attachment has content type “message/rfc822”. This happens when converting from msg(TNEF) if the attachment is added as an Outlook message. Only messages in MSG format can be added as Outlook messages. In the source file, all attachments are added as a byte array.
The message named ‘Save 40% and impress every audience’ does not contain any extension. Please check the attached image. attachment detail.jpg (607.0 KB)
Hello,
1st, I didn’t create the TNEF myself, automatically created by latest Outlook version.
2nd, you mean IsEmbeddedMessage = True If Content-Type = “message/rfc822”?
So ole2 msg/oft or emlx / other message types are not considered as embedded message? Not wise IMO.
3rd, if you say it’s based on the Content-Type, assume the message does not have any extension at all, should not make a difference right?
Finally, if we forget all the above, do you have a full recursive TNEF extractor code sample? This was what I was going to write! To extract ALL the files inside the TNEF recursively, to process all the message types attached, among with all inner attachments. Possible?
The reported issue was that the Attachment.Name and Attachment.IsEmbeddedMessage returns incorrect values. After analysis, we found that the message named ‘Save 40% and impress every audience’ does not contain any extension.
Well, can you please re-consider this logic?
As well as the other attachments which HAVE correct extensions are also returning IsEmbeddedMessage as False.
Misunderstanding! I meant how do you claim the extension based detection vs content based? Anyway…
Useless, can’t imagine to write a full depth recursive attachment extractor using the current SDK structure / limitations.
Please share your input file that contains the embedded object with and without extension. We will investigate the issue and provide you information on it.
We have closed the ticket EMAILNET-40811 as ‘Not a bug’. The message named ‘Save 40% and impress every audience’ does not contain any extension.
With Aspose.Email, you can extract the embedded objects. Please let us know the issue that you are facing while extracting the attachments.
Since the real support engineer is not directly engaged, such misunderstandings can occur, OK let’s forget about that attachment, there are more files attached marked with RED in your snapshot: attachment detail.jpg (643.1 KB)
Following is the detail of EMAILNET-40811 after analysis.
This issue was closed as ‘Not a bug’ because there is no extension in your input file.
The IsEmbeddedMessage property is true when the attachment has content type “message/rfc822”
We have logged separate ticket for your case as EMAILNET-40861 for further investigation. You will be informed once there is an update available on it.
Regarding EMAILNET-40861, in our opinion, an embedded message should have the same structure (format) as the main message. Otherwise, it’s an attached message.
You can use below code for recursive analysis of TNEF data. Hope this helps you.
public void Test()
{
MapiMessage msg = MapiMessage.LoadFromTnef("winmail.dat");
foreach (var mapiAttach in msg.Attachments)
{
ProcessAttachment(mapiAttach);
}
}
private static void ProcessAttachment(MapiAttachment mapiAttach)
{
if (mapiAttach.BinaryData != null && mapiAttach.BinaryData.Length > 0)
{
MapiMessage message = null;
MemoryStream ms = new MemoryStream(mapiAttach.BinaryData);
FileFormatInfo info = FileFormatUtil.DetectFileFormat(ms);
ms.Position = 0;
switch (info.FileFormatType)
{
case FileFormatType.Msg:
message = MapiMessage.Load(ms, new MsgLoadOptions());
break;
case FileFormatType.Eml:
message = MapiMessage.Load(ms, new EmlLoadOptions());
break;
case FileFormatType.Mht:
message = MapiMessage.Load(ms, new MhtmlLoadOptions());
break;
case FileFormatType.Emlx:
message = MapiMessage.Load(ms, new EmlxLoadOptions());
break;
default:
mapiAttach.Save(mapiAttach.DisplayName);
break;
}
if (message != null)
{
foreach (MapiAttachment innerAttach in message.Attachments)
{
ProcessAttachment(innerAttach);
}
}
}
}
Hi,
I have added case FileFormatType.Tnef: .LoadFromTnef
And also moved mapiAttach.Save(mapiAttach.DisplayName); to the 1st line so all inner items themselves are also saved!
1st, the RtfBody of items (richbody.rtf) is not extracted, how to include it?
2nd, to add support for attachment extraction of Ics and Vcf items:
case FileFormatType.Ics/Vcf:
message = MapiMessage.Load(ms)
with no options is correct?
Thanks
In this case, please try to load the ICS and VCF without load options using MapiMessage.Load(Stream). If you still face problem, please share ‘winmail.dat’ that contains these types of attachments. We will investigate the issue and provide you more information on it.
And the issue I’ve reported at the beginning also applies to .eml files, their names are returned without extension! Tried a few different extensions all created with Outlook 2021 and all of them had this issue.
Tried to extract them using Mailbee and the extensions were all OK.
Where’s the MapiAttachment.IsInline property? I mean how to distinguish between a normal and an Inline attachment?
And MapiAttachment.Size in bytes? .BinaryData.Length is what I’m looking for?
Please give me a sample to include the InlineAttachmentExtractor to this provided sample.
Please specify the difference between .DisplayName vs .FileName vs .LongFileName?
In many cases, .DisplayName has value while the other 2 are blank!
An issue:
If a.eml is attached to the root of TNEF, the file name includes extension.
But if b.eml is nested inside the a.eml, it will not return the extension anymore!
And also, saving it with no extension will result in corrupted file as seen in these 2 screen shots: Untitled.png (11.8 KB) Untitled2.png (21.5 KB)
Hardly an excuse, did you ever tried to make some test messages using Outlook and parse the TNEF file? I’m using Aspose and Mailbee side by side, and some tools as well, comparing all results.
For example, when message format is html, attachments are added different as when the format is RTF: 1.png (14.3 KB) 2.png (15.1 KB)
So, when an obvious misbehavior (even if not called a bug) is rejected…
As per our understanding, you are not satisfied with the analysis of this issue. We have logged a new ticket as EMAILNET-40885 to investigate this issue again. However, the application shared in your last post is different from first post.
Could you please share some more detail about your concerned issue? We will then update the ticket EMAILNET-40885 accordingly.