When the message_id starts with a Linefeed character (ASCII 10) the call of imapclient.listMessages(…) on (imap) server, throws an exception as below:
class com.aspose.email.system.exceptions.ArgumentException: Value does not fall within the expected range.
com.aspose.email.ahw.b(SourceFile:546)
com.aspose.email.MailMessage.setMessageId(SourceFile:734)
com.aspose.email.sz.d(SourceFile:404)
com.aspose.email.sz.a(SourceFile:246)
com.aspose.email.sz.b(SourceFile:189)
com.aspose.email.sz.f(SourceFile:179)
com.aspose.email.aax.b(SourceFile:259)
com.aspose.email.dj.a(SourceFile:306)
com.aspose.email.ayj.a(SourceFile:193)
com.aspose.email.internal.af.g.a(Unknown Source)
com.aspose.email.internal.af.h.run(Unknown Source)
java.lang.Thread.run(Thread.java:748)
at com.aspose.email.ahw.b(SourceFile:546)
at com.aspose.email.MailMessage.setMessageId(SourceFile:734)
at com.aspose.email.sz.d(SourceFile:404)
at com.aspose.email.sz.a(SourceFile:246)
at com.aspose.email.sz.b(SourceFile:189)
at com.aspose.email.sz.f(SourceFile:179)
at com.aspose.email.aax.b(SourceFile:259)
at com.aspose.email.dj.a(SourceFile:306)
at com.aspose.email.ayj.a(SourceFile:193)
at com.aspose.email.internal.af.g.a(Unknown Source)
at com.aspose.email.internal.af.h.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
The test data shown below is from java.sun.mail API (as we couldn’t fetch the data from Aspose ):
The above shown two example cases of messageIds were not fetched using Aspose (due to exception caused by the messageId with LineFeed at the begining) and java.sun.mail API was used to fetch these example test data.
Because of the exception in listMessages(…) method, we cannot skip these mails that has LineFeed as starting character in messageId. This stops our customers from receiving any mails, as long as a mail with linefeed in the message_id was not removed from the server.
we assume these message_id are produced when sending with outlook365.
Kindly investigate the issue further and provide a fix.
Can you please share the sample problematic messages with us for further investigation at our end? We need these to append to our test account and fetch using ImapClient for reproducing the issue. Your cooperation is highly appreciated in this regard.
We will be providing you an exclusive private mail account which contains the problematic mail(s) in it. Please share your/relevant team’s email address for us to send the necessary credentials of the test imap account.
This account is exclusively created for testing and kindly not share the credentials outside of the relevant team.
We have found that the error occurs only when the mail was sent from the outlook365 exchange account.
Please share the credentials in a private message. You can send a private message by clicking the username as shown in the attached image. PrivateMessage.png (17.0 KB)
We were able to reproduce the issue reported by you. We have logged a ticket as EMAILJAVA-34416 in our issue tracking system. We will update you here as soon as we have additional information.
Hi, I’m also having same problem when reading message coming from office365. I’m using the .net versoon Aspose.Email 18.8.0. Emails coming from non-office365 are working fine. Do you have fix for this?
It throws ‘Value does not fall within the expected range.’ error everytime I call .ListMessage() method if messages returned is coming from Office365.
Here is my code snippet:
var builder = new ImapQueryBuilder();
builder.HasNoFlags(ImapMessageFlags.IsRead); /* get unread messages. */
The fix to this issue will be available in the upcoming release of Aspose.Email for Java 18.9. It is expected to be released at the start of next month.
We observed this issue in Aspose.Email for .NET as well. In such cases, the issue is fixed in the .NET version first. Later it is ported to the Java version.
This fix will be available in Aspose.Email for .NET 18.9, which is expected to be released by the end of this month.
The issues you have found earlier (filed as EMAILJAVA-34416) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan