Error while converting .eml to msg.

Last post 04-01-2009, 6:50 AM by financetec. 3 replies.
Sort Posts: Previous Next
  •  03-19-2009, 8:24 AM 170618

    Error while converting .eml to msg. .NET

    Hello all!

    I 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 runs in context of a webserver. In debug-mode on windows xp sp3 (outlook is installed) using cassini as webserver it works. In release (any cpu) on windows 2003 server 64-bit (outlook isn't installed) using iis 6 as webserver it fails. I try it 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.

    Can you please provide an explanation and/or solution to this issue?

    Thanks
    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.GetType().Equals(MessageFormat.Eml.GetType())
              && pOutputFormat.GetType().Equals(MessageFormat.Msg.GetType()))
            {
                MapiMessage mapiMessage = MapiMessage.FromMailMessage(mailMessage);
                mapiMessage.Save(stream);
            }
            else if (pInputFormat.GetType().Equals(MessageFormat.Msg.GetType())
              && pOutputFormat.GetType().Equals(MessageFormat.Eml.GetType()))
            {
                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;
    }
      

    Filed under: .MSG;64bit Windows;email
     
  •  03-20-2009, 6:51 AM 170777 in reply to 170618

    Re: Error while converting .eml to msg. .NET

    Hi Volker,

    Thanks for considering Aspose.

    We will test this scenario in Windows 2003 64 bit and IIS environment and will get back to you with feedback shortly. Sorry for the inconvenience.

    Best Regards,
    Saqib Razzaq
    Support Developer, Aspose Sialkot Team
    http://www.aspose.com
    Your File Format Experts
     
  •  03-22-2009, 11:57 AM 170877 in reply to 170777

    Re: Error while converting .eml to msg.

    Hello, Volker,

    Could you please tell me,

    1) what verion of aspose.network you are using?

    2)what .net framework version?

    3)your OS version?

    Thanks


    Team Lead
    Aspose Guangzhou Team
    About Us

    Contact Us
     
  •  04-01-2009, 6:50 AM 172778 in reply to 170877

    Re: Error while converting .eml to msg.

    Hello,

    here are the informations about the environment you asked for:

    1) Aspose.Network for .NET 2.0

        version 4.6.0.1 (evaluation version with evaluation license)

    2) .net framework v2.0.50727

    3) Microsoft Windows Server 2003 R2

        standard x64 edition

        build number 3790

        service pack 2

     

    Thanks

    Volker Roeser

     
View as RSS news feed in XML