SmtpRelayFromEmlFile Method (String, String, String)
Relays (sends without any modifications) the mail message previously saved as an .EML file, to the specified recipients.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public bool RelayFromEmlFile(
	string filename,
	string senderEmail,
	string recipientEmails


Type: SystemString
The path to the file containing the message source in .EML (RFC2822) format.
Type: SystemString
The e-mail address of the sender.
Type: SystemString
The comma-delimited list of the message recipients.

Return Value

Type: Boolean
true if relay succeeded; otherwise, false.
MailBeeExceptionAn error occurred and ThrowExceptions is true.

This method reads the message raw data from a file and then sends the message intact. Sender and recipients specified in the message itself (such as From: and To: fields) are ignored.

To save a message into an .EML file, SaveMessage(String) method of MailMessage object can be used.

Note Note
If Connect method was not called prior to RelayFromEmlFile(String, String, EmailAddressCollection), MailBee will call it automatically, or send the message in direct send mode (through DNS MX lookup) if no SMTP relay server is specified in SmtpServers collection or its Priority is lower than top priority of DNS servers available in DnsServers collection.
This sample relays the mail message from .EML file to 3 recipients by submitting the message to the SMTP relay server. MessageRecipientSubmitted event is used to report which recipients have been accepted or refused.
using System;
using MailBee;
using MailBee.SmtpMail;
using MailBee.Mime;

class Sample
    // MessageRecipientSubmitted event handler.
    private static void OnMessageRecipientSubmitted(object sender,
        SmtpMessageRecipientSubmittedEventArgs e)
        if (e.Result)
            Console.WriteLine(e.RecipientEmail + " accepted by the server");
            Console.WriteLine(e.RecipientEmail + " rejected by the server");

    // The actual code.
    static void Main(string[] args)
        Smtp mailer = new Smtp();

        // Specify SMTP server to use, and enable SMTP authentication.
        SmtpServer server = new SmtpServer("", "jdoe", "secret");

        // Subscribe to the MessageRecipientSubmitted event.
        mailer.MessageRecipientSubmitted +=
            new SmtpMessageRecipientSubmittedEventHandler(OnMessageRecipientSubmitted);

        // Send the message from the file to 3 recipients.
        mailer.RelayFromEmlFile(@"C:\Temp\message.eml", "",
See Also