Reputation:
I'm trying to read the emails using java mail API.
and when I tries to get count from multipart like this:
multipart.getCount()
I am getting the below exception:
javax.mail.MessagingException: Missing start boundary
at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:872)
at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:493)
at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:240)
Any help is appreciated.
Upvotes: 0
Views: 2763
Reputation: 94
this issue can be resolved with the two properties that MimeMultipart holds... I was also having the same issue and I resolved it with:
System.setProperty("mail.mime.multipart.ignoreexistingboundaryparameter", "true");
System.setProperty("mail.mime.multipart.allowempty", "true");
When you'll read the MimeMulutiPart.java
, you'll find 5 properties:
1. mail.mime.multipart.ignoremissingendboundary(def. true)
2. mail.mime.multipart.ignoremissingboundaryparameter(def. true)
3. mail.mime.multipart.ignoreexistingboundaryparameter(def. false)
4. mail.mime.multipart.allowempty(def. false)
5. mail.mime.multipart.bmparse(def. true)
and when I tried setting the remaining false to true. it worked for me.
Upvotes: 1