MailMessageDeserialize Method (String) |
Loads a message from the specified .XML file.
Namespace: MailBee.MimeAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax public bool Deserialize(
string filename
)
Public Function Deserialize (
filename As String
) As Boolean
Parameters
- filename
- Type: SystemString
A string containing the name of the .XML file.
Return Value
Type:
Booleantrue if the message was successfully loaded from .XML file; otherwise,
false.
Exceptions 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)
{
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");
Console.WriteLine(msg.Subject);
msg.Serialize(@"C:\Temp\msg.xml");
MailMessage newMsg = new MailMessage();
newMsg.Deserialize(@"C:\Temp\msg.xml");
Console.WriteLine(newMsg.Subject);
}
}
Imports System
Imports MailBee
Imports MailBee.Mime
Module Sample
Sub Main(ByVal args As String())
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")
Console.WriteLine(msg.Subject)
msg.Serialize("C:\Temp\msg.xml")
Dim newMsg As New MailMessage
newMsg.Deserialize("C:\Temp\msg.xml")
Console.WriteLine(newMsg.Subject)
End Sub
End Module
See Also