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: 12.5.0 build 687 for .NET 4.5
Syntax
public bool RelayFromEmlFile(
	string filename,
	string senderEmail,
	string recipientEmails
)

Parameters

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

Return Value

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

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.
Examples
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");
        }
        else
        {
            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("smtp-relay.host.com", "jdoe", "secret");
        mailer.SmtpServers.Add(server);

        // 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", "jdoe@host.com",
            "client@company.com, b.smith@domain1.com, j.smith@domain2.com");
    }
}
See Also