simple-java-mail icon indicating copy to clipboard operation
simple-java-mail copied to clipboard

Nullpointer in SMIMESupport.isMimeMessageAttachment

Open Faelean opened this issue 10 months ago • 0 comments

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).

MSG-Datei_T24-03167.zip

        String msgFileName = ".\\assets_sjm\\T24-03167.msg";

        try (FileInputStream fileInputStream = new FileInputStream(msgFileName)) {

            Email email = EmailConverter.outlookMsgToEmail(fileInputStream);
            System.out.println("Sent Date: " + email.getSentDate());
        }

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)

Faelean avatar Jan 27 '25 13:01 Faelean