How to get filename of all attachements of email?
问题 I am trying to get the filename of all the attachements of emails using java and imap.My code is: MimeMessage msg = (MimeMessage) messages[i]; String fileName = msg.getFileName(); System.out.println("The file name of this attachment is " + fileName); but it prints null always even if email contain attachment..I have seen different codes on SO but none worked...and I don't know what to do if attachment is more than one . PS:I only want to get the filename and don't want to download attachments