MailMessageForwardAsAttachment Method
Forwards a mail message as attached .EML file.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public MailMessage ForwardAsAttachment()

Return Value

Type: MailMessage
A new MailMessage object containing the message as attached .EML file.
Remarks
This method constructs a new e-mail message and adds original message as an attachment, all other fields of the new message remain empty (such as Subject, Body, To, Cc and Bcc fields, etc).
Examples
This sample loads the message from .EML file, forwards it as attachment and sends the resulting message out.
using MailBee;
using MailBee.SmtpMail;
using MailBee.Mime;

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

        // Create a new message having the forwarded message as attachment.
        MailMessage newMsg = msg.ForwardAsAttachment();

        // Set up other fields of the envelope message.
        newMsg.From.AsString = "John Doe <jdoe@domain.com>";
        newMsg.To.AsString = "Alice <al@company.com>";
        newMsg.Subject = "Forwarded message";
        newMsg.BodyPlainText = "The message is attached.";

        // Send it.
        Smtp.QuickSend(newMsg);
    }
}
See Also