0

Q: I am using MailBee to gets attachemnt in winmail.data(TNEF), but I am got several other files which content type is application/octet-stream, I don't want to save this type as attachment.

Currently, my solution is using content type to judge it.

if (tnefAttachment.ContentType.ToLower() != "application/octet-stream")
{
    SaveAttachment(tnefAttachment); 
}

I don't want using content type to identify it, so have any other solution workable? Thanks in advance.

Dino Liu
  • 500
  • 4
  • 17
  • What kind of files within TNEF are you interested in? Embedded pictures, maybe? – Alex Dec 26 '16 at 09:50
  • As usual, the email contains the attachment such as Word(.docx) or Excel(.xlsx) file etc, which are encode as TNEF format, so when I am use MailBee to decode the TNEF data, I got several files which extension name is like 'application/octet-stream', and only 1 .doc file in the attachments, which is I want to saved one. – Dino Liu Dec 27 '16 at 06:55
  • It's pretty arbitrary choice of preferences of "what to save and what to skip". You need some strict, well-defined rule to determine what you want to save and what not. Currently it looks like "there are some files I want to save and there are others". BTW, application/octet-stream is universal content-type, a document file can have it sometimes. For instance, you can tell us "I want to save all files with .doc, .docx, .xls or .xlsx extension and ignore everything else. How to achieve?", etc. – Alex Dec 27 '16 at 10:09
  • All right, so I need a white list rule to filter the attachments. Thanks for you help. – Dino Liu Dec 29 '16 at 02:51

0 Answers0