Jump to content
RaelB

Error parsing winmail.dat

Recommended Posts

Hello,

 

I have been using the IdCoderTNEF unit to decode winmail.dat messages. This has worked fine for me in the past, however in the last couple of months, I have been receiving this error when trying to parse such messages:

 

EIdTnefUnknownMapiType: Encountered unknown MAPI type: 72, attribute: 32768

 

I am using the latest version of IdCoderTNEF  from the github repo (Latest commit 5fb9225 on 26 Nov 2019 )

 

Part of my code looks like this:

 

  var
    J: Integer;
    TnefMsg: TIdMessage;
    TNefCoder: TIdCoderTNEF;
    
  begin
  
  ....
        for J := 0 to IdMessage.MessageParts.Count - 1 do
      begin
        if IdMessage.MessageParts[J] is TIdText then
          ....

        if IdMessage.MessageParts[J] is TIdAttachment then
        begin
...
          TNefCoder := TIdCoderTNEF.Create;
          try
            if TNefCoder.IsFilenameTnef(IdMessage.MessageParts[J].FileName) then
            begin
              TnefMsg := TIdMessage.Create(nil);
              try
                TNefCoder.Parse(IdMessage.MessageParts[J] as TIdAttachment, TNefMsg);
                ProcessMessage(TNefMsg);
              finally
                TnefMsg.Free;
              end;
            end
            else
              SaveMessagePart(IdMessage, IdMessage.MessageParts[J], UserName);
          finally
            TNefCoder.Free;
          end;
        end;
      end;
  ....

Are you aware of such an issue?

Thanks

Share this post


Link to post

Type 72 is PT_CLSID, not sure what attribute 32768 ($8000) is. TIdCoderTNEF does not implement either one at this time. There are a LOT of MAPI properties that are not implemented yet.  TIdCoderTnef is mainly concerned with extracting things that make sense to apply to a TIdMessage.  I can look into maybe having TIdCoderTnef just skip unknown fields instead of raising an exception on them.  Or maybe exposing an event so user code can decide what to do with them.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×