Hello all,
i posted about this problem a view weeks ago and got no solution until now.
We try to convert a eml-forrmatted mail from stream into a msg-forrmatted mail and save it to an other stream with Aspose.Network.
The code below works fine when running on Microsoft Windows XP and it fails when running on Microsoft Windows Server 2003 R2,
standard x64 edition,build number 3790, service pack 2.
We use Aspose.Network for .NET 2.0 version 4.6.0.1 (evaluation version with evaluation license) and .net framework v2.0.50727.
We try to convert the email format in two different ways and in both cases the code below fails at the underlined line with a null pointer
exception while the input parameters were valid object references.
This error occurs when executing the code in context of a web application within IIS 6 as well as when executing it in a Windows Forms application.
Anyone can help me?
Best Regards
Volker Roeser
public static Stream ConvertMailFormat(Stream pStream, MessageFormat pInputFormat, MessageFormat pOutputFormat)
{
Stream stream = null;
try
{
pStream.Position = 0;
MailMessage mailMessage = MailMessage.Load(pStream, pInputFormat);
stream = new MemoryStream();
if (pInputFormat.ToString().Equals("Eml")
&& pOutputFormat.ToString().Equals("Msg"))
{
MapiMessage mapiMessage = MapiMessage.FromMailMessage(mailMessage);
mapiMessage.Save(stream);
}
else if (pInputFormat.ToString().Equals("Msg")
&& pOutputFormat.ToString().Equals("Eml"))
{
mailMessage.Save(stream, pOutputFormat);
}
stream.Position = 0;
}
catch (Exception)
{
throw
}
return stream;
}
public static Stream ConvertMailFormat(Stream pStream, MessageFormat pInputFormat, MessageFormat pOutputFormat)
{
Stream stream = null;
try
{
pStream.Position = 0;
MailMessage mailMessage = MailMessage.Load(pStream, pInputFormat);
stream = new MemoryStream();
mailMessage.Save(stream, pOutputFormat);
stream.Position = 0;
}
catch (Exception)
{
throw
}
return stream;
}