You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nullpointer in SMIMESupport.isMimeMessageAttachment #572
I'm getting a NullPointer exception when trying to parse the attached mail (had to use a zip because apparently GitHub doesn't allow msg files anymore).
This is the StackTrace I get when using the code above and 8.12.4
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.simplejavamail.api.email.AttachmentResource.getDataSource()" because "attachment" is null
at org.simplejavamail.internal.smimesupport.SMIMESupport.isMimeMessageAttachment(SMIMESupport.java:212)
at org.simplejavamail.internal.smimesupport.SMIMESupport.decryptAttachments(SMIMESupport.java:204)
at org.simplejavamail.internal.smimesupport.SMIMESupport.decryptAttachments(SMIMESupport.java:131)
at org.simplejavamail.internal.smimesupport.SMIMESupport.decryptAttachments(SMIMESupport.java:100)
at org.simplejavamail.converter.EmailConverter.decryptAttachments(EmailConverter.java:257)
at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:251)
at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:228)
at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:220)
Fixed by making Outlook/S/MIME conversion more lenient for malformed or unsupported signed payloads.
When Bouncy Castle can identify the attachment as S/MIME but the liberated content is not a MIME message or multipart payload, Simple Java Mail now keeps the original smime.p7m attachment instead of trying to promote a null converted attachment.
Example outcome:
Emailemail = EmailConverter.outlookMsgToEmail(msgInputStream);
email.getAttachments(); // contains the original smime.p7memail.getSmimeSignedEmail(); // null when no MIME email can be recovered
Activity
bbottema commentedon Jul 4, 2026
Fixed by making Outlook/S/MIME conversion more lenient for malformed or unsupported signed payloads.
When Bouncy Castle can identify the attachment as S/MIME but the liberated content is not a MIME message or multipart payload, Simple Java Mail now keeps the original
smime.p7mattachment instead of trying to promote a null converted attachment.Example outcome:
feat(converter): tolerate unsupported S/MIME payloads (#572)
bbottema commentedon Jul 8, 2026
Released in Simple Java Mail v9.0.0, which is now available from Maven Central:
https://repo1.maven.org/maven2/org/simplejavamail/simple-java-mail/9.0.0/
Release notes:
https://github.com/bbottema/simple-java-mail/releases/tag/9.0.0