Skip to content

Commit d9a9974

Browse files
committed
#351: Support legacy nested mime messages (which have no attachment names as Outlook derives it from the nested message's header 'threat-topic'). Current solution is to name the attachment ForwardedMessage.eml (copying Thunderbird)
1 parent 8632308 commit d9a9974

File tree

1 file changed

+9
-1
lines changed
  • modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage

1 file changed

+9
-1
lines changed

modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageParser.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,15 @@ private static boolean isEmailHeader(Header header, String emailHeaderName) {
206206
@SuppressWarnings("WeakerAccess")
207207
public static String parseFileName(@NotNull final Part currentPart) {
208208
try {
209-
return currentPart.getFileName();
209+
if (currentPart.getFileName() != null) {
210+
return currentPart.getFileName();
211+
} else {
212+
// replicate behavior from Thunderbird
213+
if (Arrays.asList(currentPart.getHeader("Content-Type")).contains("message/rfc822")) {
214+
return "ForwardedMessage.eml";
215+
}
216+
}
217+
return "UnknownAttachment";
210218
} catch (final MessagingException e) {
211219
throw new MimeMessageParseException(MimeMessageParseException.ERROR_GETTING_FILENAME, e);
212220
}

0 commit comments

Comments
 (0)