=?utf-8?Q?Sz=C3=A1mla.docx?=
In der Funktion kommt er aus: String fileName = part.getFileName();
Code: Select all
private boolean findInAttachment(Message message, String filterText) throws MessagingException, IOException, Exception {
boolean attachContains = false;
if(message.getContentType().contains("multipart")) {
Multipart multiPart = (Multipart) message.getContent();
int numberOfParts = multiPart.getCount();
for(int partCount = 0; partCount < numberOfParts; partCount++) {
MimeBodyPart part = (MimeBodyPart) multiPart.getBodyPart(partCount);
if(Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
// this part is attachment
String fileName = part.getFileName();
String fullName = AnalyzeEmailsApp.getUserDir() + File.separator + fileName;
if(isFileExtension(fileName, "docx")) {
part.saveFile(fullName);
attachContains = findInDocx(fullName, filterText);
DeleteAttachmentFile(fullName);
} else if(isFileExtension(fileName, "pdf")) {
part.saveFile(fullName);
attachContains = findInPdf(fullName, filterText);
DeleteAttachmentFile(fullName);
}
} // if
} // for
} // if
return attachContains;
}
Mobile version