Working Around Per-Connection Sending Limits
Previous Topic  Next Topic 

Purpose

 

This example demonstrates how to use NetMailBot when you are only permitted to send so many mails per some unit of time.

 

SMTP servers often can also be configured to limit the number of emails that can be sent per connection. NetMailBot's -reconnectaftersend parameter causes NetMailBot to send only one email per connection. That is, NetMailBot connects to the SMTP server, sends an email, disconnects, connects again, sends another email, disconnects, etc.

 

While this influences the overall performance, you do not have to worry about hitting per-connection sending limits using -reconnectaftersend.

 

NOTE: In our example here, we have a mailing list of 15 fake emails. Recall that the default limit on the number of recipients per email is 100; in order to make our demonstration of the use of -reconnectaftersend "interesting" (i.e. with multiple connects and disconnects), we are using -recipientlimit to limit the number of recipients per email to three.

 

Prepared Example Files

 

 

The archive contains one file:

 

 

File Contents

 

This is the content of the batch file:

 

NetMailBot -to test@exclamationsoft.com -body "Reconnect After Sending" -tolist "tolist.txt" -from test@exclamationsoft.com -server smtp.mycompany.com -subject "Reconnect after send" -reconnectaftersend -recipientlimit 3

 

This is the content of the tolist.txt file:

 

001@test.com,002@test.com,003@test.com,004@test.com,005@test.com,006@test.com,007@test.com,008@test.com,009@test.com,010@test.com,011@test.com,012@test.com,013@test.com,014@test.com,015@test.com

 

Steps

 

  1. Unzip the ReconnectAfterSend.zip file. This will produce a directory called "ReconnectAfterSend". Open this directory.
  2. Open Notepad and edit the batch file "ReconnectAfterSend.bat". When using -tolist-to is ignored, so you can leave that unchanged. Change the values of the parameters -from and -server to your email address and your mail server name, respectively.
  3. Invoke the batch file by double-clicking the icon or straight from the command line.
  4. NetMailbot should start up and you should see output similar to the following. In a more realistic setting with hundreds of recipients, you might omit the use of -recipientlimit, in which case each mail sent would be addressed to 100 recipients (the default recipient limit) but there would still be a disconnect / reconnect cycle between each email sent.

 

NOTE: There may be cases in which your SMTP server imposes both "per-connection" and "mails per unit time" limitations. In such cases, use both -reconnectaftersend  and -sendwait to send mass mailiings successfully. See this example for use of -sendwait.

 

Connecting to smtp.mycompany.com

Preparing message

Adding TO(1): 001@test.com

Adding TO(2): 002@test.com

Adding TO(3): 003@test.com

Sending message

Sent to mail server

Disconnecting

 

Connecting to smtp.mycompany.com

Preparing message

Adding TO(4): 004@test.com

Adding TO(5): 005@test.com

Adding TO(6): 006@test.com

Sending message

Sent to mail server

Disconnecting

 

Connecting to smtp.mycompany.com

Preparing message

Adding TO(7): 007@test.com

Adding TO(8): 008@test.com

Adding TO(9): 009@test.com

Sending message

Sent to mail server

Disconnecting

 

Connecting to smtp.mycompany.com

Preparing message

Adding TO(10): 010@test.com

Adding TO(11): 011@test.com

Adding TO(12): 012@test.com

Sending message

Sent to mail server

Disconnecting

 

Connecting to smtp.mycompany.com

Preparing message

Adding TO(13): 013@test.com

Adding TO(14): 014@test.com

Adding TO(15): 015@test.com

Sending message

Sent to mail server

Disconnecting

 

Mail sent successfully to 15 recipients