Using Aspose.Email 3.0.0, there are certain eml files that cannot be loaded and attempting to do so throws this exception:
System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex
at System.String.IndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType) at Aspose.Email.Mail.MailMessage.( , Boolean , AlternateView ) at Aspose.Email.Mail.MailMessage.a( , Boolean , AlternateView ) at Aspose.Email.Mail.MailMessage.( ) at Aspose.Email.Mail.MailMessage…ctor( , Boolean ) at Aspose.Email.Mail.MailMessage.Load(Stream stream, MessageFormat format) at Aspose.Email.Mail.MailMessage.Load(String fileName, MessageFormat format)
I’ve attached a couple of example files, the code to repro is:
public void TestLoad(string sourcePath)
{
MailMessage mm;
try
{
mm = Aspose.Email.Mail.MailMessage.Load(sourcePath);
}
catch (Exception ex)
{
Console.WriteLine("Unable to load email " + ex.Message);
return;
}
Console.WriteLine("Opened mail message " + mm.Subject);
}