MailMessageDeserialize Method (String)
Loads a message from the specified .XML file.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public bool Deserialize(
	string filename
)

Parameters

filename
Type: SystemString
A string containing the name of the .XML file.

Return Value

Type: Boolean
true if the message was successfully loaded from .XML file; otherwise, false.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionfilename is a null reference (Nothing in Visual Basic) or an empty string.
MailBeeIOExceptionAn I/O error occurred and ThrowExceptions is true.
Remarks
This method can load a message which was previously saved using Serialize(String) method.
Examples
This sample loads the message from .EML file, saves it to .XML file, and loads this message back from .XML file.
using System;
using MailBee;
using MailBee.Mime;

class Sample
{
    static void Main(string[] args)
    {
        // Load the message from file.
        MailMessage msg = new MailMessage();
        msg.LoadMessage(@"C:\Docs\TestMail.eml");

        // Display the subject of this message.
        Console.WriteLine(msg.Subject);

        // Save the message to .XML file.
        msg.Serialize(@"C:\Temp\msg.xml");

        // Load the message from .XML file and display
        // the subject of this message.
        MailMessage newMsg = new MailMessage();
        newMsg.Deserialize(@"C:\Temp\msg.xml");
        Console.WriteLine(newMsg.Subject);
    }
}
See Also