1

I'm trying to determine if attachment is mail message, i have a method for identifying if attachment is PDF from its first header bytes.

if (buffer[0] == 0x25 && buffer[1] == 0x50 && buffer[2] == 0x44 && buffer[3]== 0x46)

So first header bytes 37,80,68,70 I tried to check some email messages and saw same pattern 208(0xD0),207(0xCF),17(0x11),224(0xE0) for those messages. So my question, is it safe to assume I can always identify if the attachment is mail message from these header bytes or maybe there is a better way to check it?

Buggy
  • 135
  • 9

2 Answers2

1

You can just check if the attachment extension is ".msg" (if Attachment.Type == olAttachByValue) or check the Attachment.Type property to be olEmbeddedItem in case of an embedded message attachment.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
0

The Attachment class from the Outlook object model provides the Type property which you need to check to determine embedded items. The olEmbeddeditem value means the attachment is an Outlook message format file (.msg) and is a copy of the original message.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45