MailMessage exception on Load()

Hi,
I get a the following exception thrown trying to open the attached eml message. The only thing special I can see about the eml is that it has the same eml file in it embedded twice.

at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at Aspose.Network.Mail.Attachment.x392831ad5ca7823e(String xb41a802ca5fde63b, Boolean x8ac316db567d74cd, AttachmentCollection x8a0b266419f09a55)
at Aspose.Network.Mail.Attachment…ctor(x83903e31fd6d37d2 entity, AttachmentCollection list)
at Aspose.Network.Mail.Attachment.x5c376ef8776713f5(x83903e31fd6d37d2 xa9a706768ab5b5b1, AttachmentCollection x8a0b266419f09a55)
at Aspose.Network.Mail.MailMessage.x29c5a98a7aeed163(x83903e31fd6d37d2 xd7e5673853e47af4)
at Aspose.Network.Mail.MailMessage.xf91825db2f3f3800(x83903e31fd6d37d2 xd7e5673853e47af4)
at Aspose.Network.Mail.MailMessage.x0331700c01803722(x83903e31fd6d37d2 xa9a706768ab5b5b1)
at Aspose.Network.Mail.MailMessage.x20aee281977480cf(xe1b4184405fe3b9a x1f25abf5fb75e795)
at Aspose.Network.Mail.MailMessage…ctor(xe1b4184405fe3b9a message, Boolean checkLicense)
at Aspose.Network.Mail.MailMessage.Load(Stream stream)


The version of Aspose.Network.dll we are using is 3.9.3.0, OS is Vista SP1 and .NET Framework is 3.0. We havent updated in a while, can you confirm this has been fixed and in what version of Aspose ?

best regards,
Laku.

Hi Laku,

Thanks for considering Aspose.

I have got the similar exception with the latest version 4.6. We need to look into it in detail. I will get back to you on this shortly.

Hi,

Please find the attached hotfix that loads the eml correctly. Please test it in a separate .NET 2.0 project. The official release will be available soon which will contain dlls for .NET 3.x as well.

Hi,
I got around to trying this and it doesnt work at least not completely. After getting past the compilation stage cause of some new types we have found the following issues:

i) Parsing of quite a few emls is now broken. If you use the same example I originally sent and try to Load the eml files that are the attachments then this blows up with

System.FormatException: An invalid character was found in the mail header…
at Aspose.Network.Mime.xe8b0369f54f4b3bc.x13248c0a655a378d(String x4a3f0a05c02f235f, StringBuilder xd07ce4b74c5774a7)
at Aspose.Network.Mime.ContentType.ToString()
at Aspose.Network.Mime.ContentType.xd4b5659524a6c277(HeaderCollection x94e6ca5ac178dbd0, Boolean xbfce581ad612bb63)
at Aspose.Network.Mime.xae9fad9e3ec8cb69.get_xd4d4edd080ef0090()
at Aspose.Network.Mime.x83903e31fd6d37d2.set_xdde09ff1c56ead90(TransferEncoding xbcea506a33cf9111)
at Aspose.Network.Mime.x83903e31fd6d37d2.x20c291f0c9343969(Stream xcf18e5243f8d5fd3)
at Aspose.Network.Mail.MailMessage.xdca65735f6e113f5(xfc40702471a8657e x913c0ff544cdb00d, Boolean xc941868c59399d3e)
at Aspose.Network.Mail.MailMessage.x1b887e6eefa86388(xfc40702471a8657e xb6a159a84cb992d6, Boolean xc941868c59399d3e)
at Aspose.Network.Mail.MailMessage.xfc0ead15b6083996(xefc924b964a25846 xac163da9492644ab)
at Aspose.Network.Mail.MailMessage…ctor(xefc924b964a25846 mime, Boolean checkLicense)
at Aspose.Network.Mail.MailMessage.Load(Stream stream)

ii) The semantics of MailMessage.IsBodyHtml appears to be broken. If there is a plain text body as well as an html body in the mime then this property is “false”.

iii) Performing a Attachment.SaveRawContent(Stream) now closes the stream that is passed in as a parameter. This change breaks a lot of our existing functionality as we use MemoryStream. The

iv) To recipients is not parsed correctly for some emails, an example of such an email is attached. This was previously working. The recipient list is now returned as empty.


I also tried to download the official 4.7 and the same problems surfaced. I then tried to download the 4.6 release and that works fine, but of course does not contain the bug with the embedded eml files I reported at the start of this thread.

Any thoughts ?

regards,
Laku.

Hello, Laku,

We will fix all the issues you listed and provide backforward compatibility to make your code working fine (without change or very little change). I will keep you posted.

Hi there,
Do you have any information on the fix yet ? when it’ll be released, how is it coming along ?

regards,
Laku.

Hi there,
I noticed you released a 4.7.1, this doesn’t fix the issues I raised, is there any update yet ? Specifically the knock on issues created by the hotfix released I mentioned above.

rgds,
L.

Hi Laku,

Could you give me more details? Which one are not yet fixed? The issues you posted are resolved, except ii) -- the IsBodyHtml. It will be fixed shortly.

Hi,

I have the same problem.

I get an error : " An invalid character was found in the mail header" when I try to use MailMessage.Load with an EML file.

I try using the 4.7.2 version, but with no success.

Can you help?

I found the problem.
The attachment filename is in Hebrew.
Do you have a fix for that?
Thank you

Hi,

Thanks for considering Aspose.

Could you please post a sample eml/msg file for which this exception occurred? We will further analyze and try to fix this problem.

Can you give me a email address to send the file?

For some reason I can’t upload the file.
Thank’s

Hi,

Please use the Contact button send the email to us. You can attach the eml file in the email.

Thanks,

Hi,

Did you get around to view the problem?

The problem is the Encoding of some parts of the mail headers.

It seems that you dont support windows-1255 encoding.

Can you add this support?

Thanks

Hi,

We have fixed this bug. I will send you the hotfix shortly.

Thanks you very much.

Thank you.

I am waiting for your fix.

Thanks

Hi,

Please check the attached dll. Let me know if it works.

Thanks,

I have downloaded this new dll and this works fine for me on my development environment.

The problem now is that this dll gives a error on a windows server 2003 x64 .netframework 2.0

This error only occurs on e-mail messeges with attachments.

message:

Server Error in '/' Application.

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
   Aspose.Network.Mail.MailMessage.x1b887e6eefa86388(xfc40702471a8657e xb6a159a84cb992d6, Boolean xc941868c59399d3e) +0
   Aspose.Network.Mail.MailMessage.xfc0ead15b6083996(xefc924b964a25846 xac163da9492644ab) +862
   Aspose.Network.Mail.MailMessage..ctor(xefc924b964a25846 mime, Boolean checkLicense) +192
   Aspose.Network.Mail.MailMessage.Load(Stream stream) +112
   HRC.Web.Application.ShowEmail.Page_Load(Object sender, EventArgs e) in c:\FinalBuilderWorkFolder\HRCCRM\HRC.Web.Application\ShowEmail.aspx.cs:49
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

Hope you can fix this problem.

Hello,

It is a known issue for x64. To fix this issue, you need to use the build for x64 platform. Please check the attached dll.