开发者

Verifying/testing the output of mime4j parsed content

开发者 https://www.devze.com 2023-03-16 08:55 出处:网络
I am creating a tool that is required to parse incoming MIME streams and return the email body and email attachments as separate file streams.

I am creating a tool that is required to parse incoming MIME streams and return the email body and email attachments as separate file streams.

I am using mime4j for this purpose.

Following are the problems that I am stuck on:

  1. How can I test whether the email body file or email attachment file that I parsed out via mime4j from MIME stream is correct?

I have a lar开发者_StackOverflow社区ge corpus of emails available in raw mime form that I want to run my tests on and need some automated way to determine which ones might be breaking the mime parsing by mime4j and tweak the code for that.


You could decode the attachments and then re-encode them. If the re-encoded stream matches (byte-for-byte) the original, then that's a good sign that mime4j is properly handling them.


I initially parsed out a sample corpus *.eml files using mime4j. I had to manually check them for parsing errors as I had no other good choice.

Now I am using the earlier parsed out emails as testbed over which I check my parsed out results iteratively.

0

精彩评论

暂无评论...
验证码 换一张
取 消