Controlling Throughput to the SMTP Server
Previous Topic  Next Topic 

Purpose

 

This example demonstrates how to control the rate at which NetMailBot sends data (outgoing mail) to the SMTP server. The parameter used to achieve this is -sendwait.

 

This is useful when your ISP or SMTP Server Administrator has restricted the rate at which you can send mails with the server. Many SMTP servers can be configured to restrict the number of mails allowed to be sent per connection per some unit of time, for example, ten mails per minute. A symptomatic response from the SMTP server indicating that the sender has exceeded this limit might be "No more transactions allowed." You can log the interactions between NetMailBot and the SMTP server with the -logfile and -debug parameters in order to catch such error messages.

 

NetMailBot's -sendwait parameter allows you to specify an amount of time that NetMailBot should wait between sending emails. Ask your ISP or SMTP Server Administrator if such a limit exists and what it is. This might help you adjust the delay time you specify with -sendwait without too much trial-and-error.

 

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 demonstrate the use of -sendwait without having to create a list of several hundred fake email addresses, we are using -recipientlimit to limit the number of recipients per email to three.

 

Prepared Example Files

 

 

The archive contains two files:

 

 

File Contents

 

This is the content of the batch file:

 

NetMailBot -to test@exclamationsoft.com -body "Send w/ Throttling" -tolist "tolist.txt" -from email@domain.com -server smtp.test.com -subject "Controlling send rate" -sendwait 2000 -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 ThrottleSending.zip file. This will produce a directory called "ThrottleSending". Open this directory.
  2. Open Notepad and edit the batch file "ThrottleSending.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 two second delay between emails.

 

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 -reconnectaftersend.

 

Connecting to smtp.test.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

Waiting 2000ms...

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

Waiting 2000ms...

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

Waiting 2000ms...

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

Waiting 2000ms...

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