Forwards a mail message as attached .EML file.
A new MailMessage object containing the message as attached .EML file.
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).
This sample loads the message from .EML file, forwards it as attachment and sends the resulting message out.
[C#] 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); } }
[Visual Basic] Imports MailBee Imports MailBee.SmtpMail Imports MailBee.Mime Module Sample Sub Main(ByVal args As String()) ' Load the message from file. Dim msg As New MailMessage msg.LoadMessage("C:\Docs\msg.eml") ' Create a new message having the forwarded message as attachment. Dim newMsg As MailMessage = 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) End Sub End Module
MailMessage Class | MailBee.Mime Namespace