Relays (sends without any modifications) the mail message previously saved as an .EML file, to the specified recipients.
true if relay succeeded; otherwise, false.
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 method of MailMessage object can be used.
Note If Connect method was not called prior to RelayFromEmlFile, 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.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample relays the mail message from .EML file to the recipients, using the following configuration (which targets high reliability of send mail operation):
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.SmtpMail; using MailBee.Mime; // The actual code (put it into a method of your class) Smtp mailer = new Smtp(); mailer.SmtpServers.Add("smtp1.domain.com", 25, 0); // top priority. mailer.SmtpServers.Add("smtp2.domain.com", 25, 1); // low priority. // Auto-detect DNS servers from OS settings or config file. mailer.DnsServers.Autodetect(); // Add backup DNS server of low priority (priority of DNS servers // registered in OS is usually in the range 0 to 10). mailer.DnsServers.Add("10.20.30.40", 100); // Send the message from the file. mailer.RelayFromEmlFile(@"C:\Temp\message.eml", "from@domain.com", new EmailAddressCollection("to@company.com"));
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.SmtpMail Imports MailBee.Mime ' The actual code (put it into a method of your class) Dim mailer As New Smtp mailer.SmtpServers.Add("smtp1.domain.com", 25, 0) ' top priority. mailer.SmtpServers.Add("smtp2.domain.com", 25, 1) ' low priority. ' Auto-detect DNS servers from OS settings or config file. mailer.DnsServers.Autodetect() ' Add backup DNS server of low priority (priority of DNS servers ' registered in OS is usually in the range 0 to 10). mailer.DnsServers.Add("10.20.30.40", 100) ' Send the message from the file. mailer.RelayFromEmlFile("C:\Temp\message.eml", "from@domain.com", _ New EmailAddressCollection("to@company.com"))
Smtp Class | MailBee.SmtpMail Namespace | Smtp.RelayFromEmlFile Overload List