+1 vote

If my program pulls in the forwarded email with a PDF file attached, it thinks that mime.ContentType is "application/octet-stream".

If I just send a new email and attach the pdf file, my program thinks that mime.ContentType is "application/pdf" (this is correct).

Is there something else I should be looking at for the NonVisuals collection to determine the file type of the attachment?

by

1 Answer

0 votes
 
Best answer

MimeData.ContentType property is what you should use to obtain attachments content type.

Mail.dll doesn't guess the content type, it parses MIME data received from the IMAP or POP3 server.

If the attachment has Content-Type header set to application/octet-stream MimaData.ContentType property will reflect that.

You can use MimaData.SafeFileName to access file name specified by the sender to obtain filename's extension.

by (298k points)
...