SmtpSubmitJobsToPickupFolder Method
Saves all e-mails in the pending jobs queue (including e-mails generated via mail merge) as files in the pickup folder of MailBee.NET Queue or IIS SMTP service.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public bool SubmitJobsToPickupFolder(
	string pickupFolderName,
	bool doubleFirstDotAtLine


Type: SystemString
The full physical path to MailBee.NET Queue or IIS SMTP pickup folder (such as "C:\Inetpub\mailroot\Pickup").
Type: SystemBoolean
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 at 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

Type: Boolean
true, if the entire queue of pending jobs has been processed and saved; false, if the operation was stopped due to an error.
MailBeeExceptionAn error occurred and ThrowExceptions is true.

This method can be used to submit jobs directly to MailBee.NET Queue or IIS SMTP service bypassing SMTP protocol. This greatly improves performance of sending large volumes of jobs 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.

Consider setting mailer.Message.Builder.SetDateOnSend to false when submitting to the pickup folder (mailer is Smtp instance). See SetDateOnSend for details.

Note Note
Although this method saves messages into files rather than sends them out, most methods and properties affecting SendJobs method execution (such as StopJobs or StopJobsOnError) apply to SubmitJobsToPickupFolder(String, Boolean) method as well. The same applies to processing of job queues (such as JobsPending).
In the case if messages are saved to pickup folder rather than being sent out, it's recommended to set StopJobsOnError to true. This is because if any error occurs during saving files (for instance, disk is full), most probably this error will repeat for all subsequent messages and it doesn't make sense to continue processing.
This console sample performs mail merge via submitting resulting messages into IIS SMTP pickup folder. Events are used to track progress of the operation.
using System;
using System.Data;
using System.Data.OleDb;
using MailBee;
using MailBee.Mime;
using MailBee.SmtpMail;

class Sample
    static void mailer_MergingMessage(object sender, SmtpMergingMessageEventArgs e)
        Console.WriteLine("Will create an e-mail from data row #" + e.MergeRowIndex);

    static void mailer_SubmittingMessageToPickupFolder(object sender,
        SmtpSubmittingMessageToPickupFolderEventArgs e)
        Console.WriteLine("Will queue an e-mail from data row #" + e.MergeRowIndex);

    static void mailer_MessageSubmittedToPickupFolder(object sender,
        SmtpMessageSubmittedToPickupFolderEventArgs e)
        Console.WriteLine("The e-mail from data row #" + e.MergeRowIndex +
            " saved as " + e.Filename);

    static void Main(string[] args)
        Smtp mailer = new Smtp();

        // Logging into a file is useful for troubleshooting.
        mailer.Log.Filename = @"C:\Temp\log.txt";
        mailer.Log.Enabled = true;
        mailer.Log.Format = LogFormatOptions.AddContextInfo;

        // Subscribe to 3 events to track send bulk mail progress.
        mailer.MergingMessage += new SmtpMergingMessageEventHandler(mailer_MergingMessage);
        mailer.SubmittingMessageToPickupFolder +=
            new SmtpSubmittingMessageToPickupFolderEventHandler(
        mailer.MessageSubmittedToPickupFolder +=
            new SmtpMessageSubmittedToPickupFolderEventHandler(

        // Setup e-mail message header template for mail merge.
        mailer.Message.From.AsString = "John Doe <>";
        mailer.Message.To.AsString = "##Name## <##Email##>";
        mailer.Message.Subject = "Our Jan/2007 newsletter";

        // Setup HTML body template.
        mailer.Message.BodyHtmlText = "<html>##Body##</html>";

        // Specify database connection string (it may be different in your case).
        string connParams = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Temp\newsletter.mdb;";

        // Connect to the database and populate mail merge job to-do list with
        // the data from "mailing_list" table.
        using (OleDbConnection conn = new OleDbConnection(connParams))
            // Open the connection and get the data.
            OleDbCommand command = new OleDbCommand("SELECT * FROM mailing_list", conn);
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            DataTable table = new DataTable();
            adapter.SelectCommand = command;

            mailer.AddJob(null, null, null, table);

        // Run mail merge.
        mailer.SubmitJobsToPickupFolder(@"C:\Inetpub\mailroot\Pickup", true);
See Also