We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Failed to load the eml file into MailMessage

Hi,
I am using Aspose.Email.dll(4.0) to create the pst file.
I got following exception when I try to load the eml file into MailMessage.
=========================================================
The header name has an unexpected characters
ERROR2014-05-07 14:42:03 - Stack Strace :: at .?.?()
at .?.?()
at .??.??()
at .??.?(Byte[] )
at .??.?()
at Aspose.Email.Mail.MailMessage.??(Stream , MailMessageLoadOptions )
at Aspose.Email.Mail.MailMessage.Load(Stream stream, MailMessageLoadOptions options)
at Aspose.Email.Mail.MailMessage.Load(String fileName, MessageFormat format)
=====================================================================

Please see the attached eml file.
Thanks in advance.

Hi Pooja,


Thank you for sharing your concern with us.

I was able to reproduce this issue at my end using the latest version of Aspose.Email for .NET 4.1.0 and have logged it as NETWORKNET-34354 in our issue tracking system for further investigation by our development team. Once there is any information available in this regard, we’ll update you here via this thread here.

We are sorry for the inconvenience caused to you.

Hi,

Is there any solution you got.
Since this issue occurs very frequently.

Please consider this issue on priority basis.

Thanks and Regards,
Pooja

Hi Pooja,


We have investigated this issue at our end and found it not to be a bug at Aspose.Email’s end. If you open source file in any text editor, you can see that the 2nd line (Message-ID header) is corrupt. In order to load this file correctly, please use FileCompatabilityMode.SkipValidityChecking as shown below:

MailMessageLoadOptions options = MailMessageLoadOptions.DefaultEml;
options.FileCompatibilityMode = FileCompatibilityMode.SkipValidityChecking;
MailMessage mail = MailMessage.Load(fileName, options);

Hi,
Thanks for the quick reply.It is really great that you give the solution.
It is working for me.But again there are some eml file which got fail.
I attached the sample file.
It has some garbage character in the header but still as per
----------------------------------------------------------------------------------------

MailMessageLoadOptions options = MailMessageLoadOptions.DefaultEml;
options.FileCompatibilityMode = FileCompatibilityMode.SkipValidityChecking;
MailMessage mail = MailMessage.Load(fileName, options);
-----------------------------------------------------
it should work.
Please test with the attached file.

Thanks and Regards,
Pooja

Hi Pooja,


Could you please make sure that you are using the latest version of Aspose.Email for .NET 4.1.0? I have tested this new sample file with the latest version and I am afraid to share that the issue is not reproducible at my end. Your feedback will help us assist you further in this regard.