MailBee.NET Objects 7.2

Smtp.SubmitToPickupFolder Method (String, String, String, EmailAddressCollection, Boolean)

Saves the mail message as a file in the pickup folder of MailBee.NET Queue or IIS SMTP service.

public string SubmitToPickupFolder(
   string pickupFolderName,
   string filename,
   string senderEmail,
   EmailAddressCollection recipients,
   bool doubleFirstDotAtLine
);

Parameters

pickupFolderName
The full physical path to MailBee.NET Queue or IIS SMTP pickup folder (such as "C:\Inetpub\mailroot\Pickup").
filename
The filename (without folder path) of the file to be saved, or a null reference (Nothing in Visual Basic). If latter, MailBee will automatically generate a unique filename.
senderEmail
The e-mail address of the sender. If it's a null reference (Nothing in Visual Basic), the e-mail address is taken from From property.
recipients
The list of the message recipients. If it's a null reference (Nothing in Visual Basic), the recipients list is combined from To, Cc, and Bcc lists.
doubleFirstDotAtLine
You must set it to true when submitting to IIS SMTP pickup folder and to false when using MailBee.NET Queue. SMTP protocol requires the client to double the dot character (make ".." from ".") when it appears in the beginning of a line. However, unlike MailBee.NET Queue, IIS SMTP service is not capable of performing this conversion, and doubleFirstDotAtLine parameter workarounds this (when true, MailBee itself will double dots when required).

Return Value

On success, the filename (without folder path) of the file saved in the pickup folder; otherwise, a null reference (Nothing in Visual Basic).

Remarks

This method can be used to submit messages directly to MailBee.NET Queue or IIS SMTP service bypassing SMTP protocol. This greatly improves performance of sending large volumes of e-mails when MailBee.NET Queue or IIS SMTP server is installed on the same machine or in the same LAN as the computer running MailBee. This method neither creates nor requires network connection.

Note   This method can return a null reference also if SubmittingMessageToPickupFolder even handler set SubmitIt to false.

Exceptions

Exception Type Condition
MailBeeException An error occurred and ThrowExceptions is true.

Example

This sample submits a mail message to IIS SMTP server by placing it in the pickup folder. The message file will be saved as "C:\Inetpub\mailroot\Pickup\001.eml".

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();
mailer.From.Email = "jdoe@domain.com";
mailer.To.Add("kathy@company.com");
mailer.Subject = "Report";
mailer.BodyPlainText = "The report contents";
mailer.SubmitToPickupFolder(@"C:\Inetpub\mailroot\Pickup", "001.eml", "bounce@domain.com",
    (EmailAddressCollection)null, true);
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.SmtpMail

' The actual code (put it into a method of your class)

Dim mailer As New Smtp
mailer.From.Email = "jdoe@domain.com"
mailer.To.Add("kathy@company.com")
mailer.Subject = "Report"
mailer.BodyPlainText = "The report contents"
mailer.SubmitToPickupFolder("C:\Inetpub\mailroot\Pickup", "001.eml", "bounce@domain.com", _
    CType(Nothing, EmailAddressCollection), True)

See Also

Smtp Class | MailBee.SmtpMail Namespace | Smtp.SubmitToPickupFolder Overload List