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
Enhancement: make Outlook support tolerant of invalid/empty nested Outlook message attachments #396
If you work with Outlook/Exchange you can request delivery receipts for your emails. After sending an email, you'll get a receipt if the email has been successfully delivered to the recipient's server.
If the recipient's server supports these confirmations, the returning email can successfully be parsed and converted by Simple-Java-Mail's Outlook to email converter.
If the recipient's server doesn't support this feature, you'll get a different email from your Exchange server. This message contains an attached email without body (empty text, empty html, empty rtf). Therefore the OutlookEmailConverter.buildEmailFromOutlookMessage recursive call fails on line 111 because the mime-body of the attached mail is empty and the whole conversion is stopped with an IllegalStateException (InternalEmailConverterImpl.java:42).
It seems like I've ran into the same/a similar issue
I have an example mail that states that the recipient's server did not send a receipt for successfully delivering the mail so I thought this might be the same base use case. If not sorry for hijacking this issue, I'll open a new one then. I can't publish the mail here, but if you wand I can send it to you directly.
I've tested this with version 7.1.1, but the original problem was discovered on a system using 6.6.1.
Using the EmailConverter I get two warnings and finally the IllegalStateException.
Doing the same with the OutlookMessageParser works as expected.
14:01:43 [main] WARN OutlookMessage - Skipping nested Outlook message as file attachment, writing Outlook messages back as data is not supported!
14:01:43 [main] WARN OutlookMessage - To access the nested Outlook message as parsed Java object, refer to .getAttachments() instead.
Exception in thread "main" java.lang.IllegalStateException: This should never happen
at org.simplejavamail.converter.EmailConverter.mimeMessageToEMLByteArray(EmailConverter.java:559)
at org.simplejavamail.converter.internal.InternalEmailConverterImpl.mimeMessageToEMLByteArray(InternalEmailConverterImpl.java:41)
at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.buildEmailFromOutlookMessage(OutlookEmailConverter.java:126)
at org.simplejavamail.internal.outlooksupport.converter.OutlookEmailConverter.outlookMsgToEmailBuilder(OutlookEmailConverter.java:85)
at org.simplejavamail.converter.EmailConverter.outlookMsgToEmailBuilder(EmailConverter.java:239)
at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:221)
at org.simplejavamail.converter.EmailConverter.outlookMsgToEmail(EmailConverter.java:213)
at ParseP7s.main(ParseP7s.java:30)
Caused by: java.io.IOException: No MimeMessage content
at jakarta.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:92)
at jakarta.activation.DataHandler.writeTo(DataHandler.java:278)
at jakarta.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1670)
at jakarta.mail.internet.MimeMessage.writeTo(MimeMessage.java:1888)
at jakarta.mail.internet.MimeMessage.writeTo(MimeMessage.java:1862)
at org.simplejavamail.converter.EmailConverter.mimeMessageToEMLByteArray(EmailConverter.java:555)
... 7 more
Caused by: jakarta.mail.MessagingException: No MimeMessage content
at jakarta.mail.internet.MimeMessage.getContentStream(MimeMessage.java:1395)
at jakarta.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:78)
... 12 more
@Faelean I'm pretty sure you're mentioning the exact same issue. I could temporary fix it by doing a null check on nestedMsg's html, text and rtfText properties. If none of these properties are set, I skip the recursive call to ignore the nested (empty) email.
changed the title [-]outlookMsgToEmail fails with unsuccessful Exchange delivery receipts[/-][+]Enhancement: outlookMsgToEmail fails with unsuccessful Exchange delivery receipts[/+]on Jul 13, 2022
changed the title [-]Enhancement: outlookMsgToEmail fails with unsuccessful Exchange delivery receipts[/-][+]Enhancement: make Outlook support tolerant of invalid/empty nested Outlook message attachments[/+]on Jul 13, 2022
Fixed in 7.2.1. I'm just ignoring this very specific exception cause. Might be good to ignore any and all exceptions here, but for now I rather take it case by case, so we slowly build up a catalogue of known Outlook issues.
Activity
Faelean commentedon Jun 22, 2022
It seems like I've ran into the same/a similar issue
I have an example mail that states that the recipient's server did not send a receipt for successfully delivering the mail so I thought this might be the same base use case. If not sorry for hijacking this issue, I'll open a new one then. I can't publish the mail here, but if you wand I can send it to you directly.
I've tested this with version 7.1.1, but the original problem was discovered on a system using 6.6.1.
Using the EmailConverter I get two warnings and finally the IllegalStateException.
Doing the same with the OutlookMessageParser works as expected.
bbmedia commentedon Jun 23, 2022
@Faelean I'm pretty sure you're mentioning the exact same issue. I could temporary fix it by doing a null check on
nestedMsg's html, text and rtfText properties. If none of these properties are set, I skip the recursive call to ignore the nested (empty) email.See
simple-java-mail/modules/outlook-module/src/main/java/org/simplejavamail/internal/outlooksupport/converter/OutlookEmailConverter.java
Line 107 in f306e89
bbottema commentedon Jul 12, 2022
@bbmedia, would you be able to share the email privately with me? I would like to see the error and investigate.
bbmedia commentedon Jul 13, 2022
@bbottema Just sent you an example by email. Thanks a lot!
[-]outlookMsgToEmail fails with unsuccessful Exchange delivery receipts[/-][+]Enhancement: outlookMsgToEmail fails with unsuccessful Exchange delivery receipts[/+][-]Enhancement: outlookMsgToEmail fails with unsuccessful Exchange delivery receipts[/-][+]Enhancement: make Outlook support tolerant of invalid/empty nested Outlook message attachments[/+]#396: ignore error in case attached nested Outlook message actually c…
bbottema commentedon Jul 13, 2022
Fixed in 7.2.1. I'm just ignoring this very specific exception cause. Might be good to ignore any and all exceptions here, but for now I rather take it case by case, so we slowly build up a catalogue of known Outlook issues.
bbottema commentedon Jul 13, 2022
About 6.x.x version range, I'm not sure I want to support it there. You can't move to 7.x.x? 6 is really old school.
bbmedia commentedon Jul 19, 2022
Thanks a lot for solving this issue!
We are currently bound to 6.x.x because of the javax/jakarta dependency. But I do completely understand your point.
bbmedia commentedon Jul 21, 2022
We finally managed to fully migrate to 7.4.0.
You can forget about V6 regarding this issue.
Thanks a lot for all your work!