Free Support Forum - aspose.com

Need to identify exact content type of mail(outlook or email) which don't have contain extension

Hi
I am trying to identify the exact mimetype for mail documents which doesn’t have extension to it.
i am trying to use email.getContentType() resulting “application/octet-stream” which is not correct.

Please help us is there any api to get content type of mail documents or any code snippets available.

Thanks in advance.

@ssamidis

Actually, the Content of MimePart in general case this is set of bytes. The field ContentType is used for definition type of this content by sender(or creator of mail document) for correct parsing on receiver side. So if the field ContentType is incorrect, we don’t know way to define type of content. There may exist many techniques to recognize format of set of bytes, but these techniques require many resources and are not in scope of Aspose.Email or other mail clients. The content type must be present and only then API will be able to read that.