MailMessageClone Method
Creates a copy of the message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public MailMessage Clone()

Return Value

Type: MailMessage
A MailMessage object which represents the cloned message.
Remarks
The deep clone is performed, that means the fully independent copy of the message is created and there are no shared objects between the original message and its copy.
Examples
This sample demostrates that the message copy created by this method has its own copies of all internal objects. For instance, their Attachments collections are another objects, not just two references to the same object.
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");

        MailMessage newMsg = msg;
        MailMessage clonedMsg = msg.Clone();

        // Check if the attachments of two messages are equal
        // and display the corresponding notification.
        if (msg.Attachments == newMsg.Attachments)
        {
            Console.WriteLine("Equals");
        }
        else
        {
            Console.WriteLine("Not equals");
        }

        // Check if the attachments of two messages are equal
        // and display the corresponding notification.
        if (msg.Attachments == clonedMsg.Attachments)
        {
            Console.WriteLine("Equals");
        }
        else
        {
            Console.WriteLine("Not equals");
        }
    }
}

// Output:
// Equals
// Not equals
See Also