I have a java (groovy) script that uses Aspose to convert .MSG files to .EML for onward processing. It manages many millions of files perfectly - but just a few fail. Most of the fail cases seem to be appointment responses, but some are not. I can fix one case (the WMF metafile) by only converting to plain text - but this looses the tabular text in the email.
I am sorry, but I am unable to share any example emails.
All of them can be displayed in Outlook - though some indicate a troublesome attachment.
Aspose version: aspose-email-25.4-jdk16
I am trying the following work-arounds - but can I use any others?
MapiMessage mapi = MapiMessage.load(aMailFile.absolutePath)
[work-around 1 - error reading WMF: remove any attachments with a file name ending .wmf] (perhaps wmf attachments do not have simple file names?)
[work-around 2 - arg out of range: remove the PR_START_DATE property, if it exists] (perhaps there are other properties that cause the arg out of range? How can I find out?
[work-around 3 - force plain text: mapi.setBodyContent(mapi.getBody(), BodyContentType.PlainText)] But this looses some detail from the resulting email, though it fixes one of these errors.
Caught: class com.aspose.email.system.exceptions.ArgumentException: Error reading WMF metafile. —> class com.aspose.email.internal.bc.zb: Error reading WMF metafile. —> class com.aspose.email.internal.bc.zb: Error reading Emf metafile —> java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
— End of inner exception stack trace —
com.aspose.email.internal.an.zb.a(Unknown Source)
com.aspose.email.internal.ai.za.b(Unknown Source)
com.aspose.email.internal.ai.za.(Unknown Source)
com.aspose.email.internal.an.za.a(Unknown Source)
com.aspose.email.internal.an.za.a(Unknown Source)
com.aspose.email.internal.dp.zg.a(Unknown Source)
com.aspose.email.internal.ai.zd.b(Unknown Source)
com.aspose.email.internal.ai.zd.(Unknown Source)
com.aspose.email.internal.ai.zc.a(Unknown Source)
com.aspose.email.internal.j.zl.(Unknown Source)
com.aspose.email.internal.h.zn.a(Unknown Source)
com.aspose.email.internal.h.zn.a(Unknown Source)
com.aspose.email.internal.h.zn.a(Unknown Source)
com.aspose.email.zaiz.a(SourceFile:1834)
com.aspose.email.zaiz.b(SourceFile:908)
com.aspose.email.zaiz.a(SourceFile:297)
com.aspose.email.MapiMessage.toMailMessage(SourceFile:2270)
Caught: class com.aspose.email.system.exceptions.EndOfStreamException: Attempted to read past the end of the stream.
com.aspose.email.internal.n.zb.a(Unknown Source)
com.aspose.email.internal.n.zb.h(Unknown Source)
com.aspose.email.MapiCalendarExceptionInfo.(SourceFile:164)
com.aspose.email.MapiCalendarRecurrencePatternFactory.a(SourceFile:192)
com.aspose.email.MapiCalendarEventRecurrence.(SourceFile:145)
com.aspose.email.MapiCalendar.(SourceFile:449)
com.aspose.email.MapiCalendar.(SourceFile:374)
com.aspose.email.MapiMessage.toMapiMessageItem(SourceFile:2229)
com.aspose.email.zaw.a(SourceFile:82)
com.aspose.email.MapiMessage.toMailMessage(SourceFile:2270)
Caught: class com.aspose.email.system.exceptions.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: count is less than 0
com.aspose.email.internal.n.zb.b(Unknown Source)
com.aspose.email.MapiCalendarExceptionInfo.(SourceFile:137)
com.aspose.email.MapiCalendarRecurrencePatternFactory.a(SourceFile:192)
com.aspose.email.MapiCalendarEventRecurrence.(SourceFile:145)
com.aspose.email.MapiCalendar.(SourceFile:449)
com.aspose.email.MapiCalendar.(SourceFile:374)
com.aspose.email.MapiMessage.toMapiMessageItem(SourceFile:2229)
com.aspose.email.zaw.a(SourceFile:82)
com.aspose.email.MapiMessage.toMailMessage(SourceFile:2270)