I am facing this issue after using the mac mailing service.
able to read attachments if I use outlook or gmail.
piece of code where I am reading the attachment from mail.
if (contentType.contains("multipart"))
{
Multipart multiPart = (Multipart) msg.getContent();
int partCount = multiPart.getCount();
for (int j = 0; j < partCount; j++)
{
BodyPart part = multiPart.getBodyPart(j);
if (Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) // getting null here
{
attachmentProcessing = true;
InputStream is;
is = part.getInputStream();
f = new File(filePath + part.getFileName());
fileArray.add(f);
FileOutputStream fos = new FileOutputStream(f);
byte[] buf = new byte[4096];
int bytesRead;
while((bytesRead = is.read(buf))!=-1) {
fos.write(buf, 0, bytesRead);
}
fos.close();
}
}
}
part details for mac mailing service:
text/plain; charset=us-ascii
part.getDisposition() = null
multipart/mixed; boundary="Apple-Mail=_C50D7E2D-27A1-4449-BAA3-5DC9D1E522AF"
and for others
multipart/mixed; boundary="----=_NextPart_000_0033_01D28DC6.C9D0C8B0"
text/plain; name=HashTagList.txt; charset=us-ascii
part.getDisposition() = attachment