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

Free Support Forum - aspose.com

Advise on opening TNEF

Hello,
I’ve got 3 queries about MapiMessage.LoadFromTnef

  1. Please kindly advise when loading TNEF:
    Dim MyMapiMessage As MapiMessage = MapiMessage.LoadFromTnef(src)
    The resulting MyMapiMessage will always have body?
    I mean TNEF must always have richbody.rtf rtf body or html/plain text parts?
    Or it’s possible that it’s just non-body file attachments?

I will need to go 2 different paths based on if it has any of 3 body parts or not, but not sure if TNEF can have no rtf/html/plain text parts or not?

  1. After LoadFromTnef, if MapiMessage only has rtf part, and I save MapiMessage as MailMessage, is source MapiMessage rtf body converted to simple html or plain text body in the target MailMessage?

  2. Finally, after LoadFromTnef, this code will save body as txt but non-ASCII characters are saved as question mark:
    File.WriteAllText(target, MyMapiMessage.Body, Encoding.UTF8)
    Am I doing it wrong?

Best :slight_smile:

@australian.dev.nerds,

The resulting MyMapiMessage will always have body?
I mean TNEF must always have richbody.rtf rtf body or html/plain text parts?
Or it’s possible that it’s just non-body file attachments?

TNEF is encapsulated MAPI properties. TNEF contains MapiMessage properties.

After LoadFromTnef, if MapiMessage only has rtf part, and I save MapiMessage as MailMessage, is source MapiMessage rtf body converted to simple html or plain text body in the target MailMessage?

The original rtf is converted either to HTML or Plain Text, depending on what was wrapped in it. See my explanation in this post regarding extended RTF.

Am I doing it wrong?

Can you send the source tnef for checking?

Thanks.