How to Send Email to a List in Excel
Previous Topic  Next Topic 

Purpose

 

This example demonstrates how to send email to a list of email addresses contained in a Microsoft Excel spreadsheet.

 

Additional Prerequisites

 

Using this feature requires Microsoft Excel, in order to be able to edit the Excel spreadsheet as described below, and the latest ODBC drivers, obtainable at the Microsoft website.

 

Create an Excel Spreadsheet

 

  1. Open Microsoft Excel. 
  2. In cell A1, enter the text "email" 
  3. In cell A2, enter a valid email address (suggestion: your own email address)
  4. In cell A3, enter another valid email address (this can again be your own email address)
  5. Highlight all three of these cells
  6. Select the menu item "Insert->Name->Define" (this may be different for versions before Microsoft Office 2000). A dialog box will appear. 
  7. Enter the name of the range, "customer", then click "OK". See this screenshot:

 

 

  1. Save the spreadsheet in an easy to find location, such as "C:\tmp" and name the file "example.xls". 

 

Create an ODBC DSN

 

  1. Create an ODBC DSN for Excel named "example". For instructions on creating an ODBC DSN, click here.

 

Create a batch file 

 

  1. In the same directory that you saved the Excel spreadsheet, create a batch file named "example.bat". For instructions on creating a batch file, click here.
  2. Cut-and-Paste the following text into your "example.bat" batch file: 

 
"c:\program files\netmailbot\netmailbot.exe" -to "change@me.com" -server "mail.changeme.com" -dsn "DSN=example" -dbtable "customer" -dbemailcolumn "email" -dbuseaddressee "to" -recipientlimit 1 -from "change@me.com" -subject "test" -logfile "logfile.txt" -debug

 

  1. If necessary, change the path to match your installation of netmailbot.exe. Change the -to, -from, and -server parameters to your own email address and mail server.

 

NOTE: If you use your own email address in the spreadsheet as described above, your email account should receive three emails - one for the fact that you are listed in the -to parameter and two more for the two email addresses found in the spreadsheet (both being your email address) and the use of -recipientlimit 1.