Mail Merge with a CSV (text) file setting "Friendly Names"

This example demonstrates how to send an email using the mail merge features in NetMailBot, specifically how to set the friendly name of the recipient. The database used is a text file in CSV format (comma delimited file) which contains some sample data. NOTE: You should change the email addresses in the text file to your own email address(es) before running a test.
  • Requirements
    • Working knowledge of creating and editing a batch file.

  • Example Download
    A working example can be downloaded, so that you can follow along with the example:
     Click Here (csv2.zip 1KB)
    The downloadable example is a zip file that contains three files:
    • data.txt - A file containing customer data
    • body.txt - A file that is the message body
    • mail_merge.bat - The batch file that will instruct NetMailBot to send the email message.

    Instructions for Download and Installation

    • Download the example zip file and save it to your hard drive
    • Create a directory on your C drive named "tmp"
    • Unzip all of the files in the example zip file into the newly created directory c:\tmp.

  • Steps
    1. Open the data.txt file by double-clicking on it from My Computer.
    2. Change all of the email addresses to your email address. The email addresses can all be the same.
    3. Save and close data.txt
    4. Open Notepad and edit the batch file mail_merge.bat.

      Some important parameters used in the batch file

      • Change the parameters: -to test@exclamationsoft.com -from test@exclamationsoft.com to your own email address.
      • Change the parameter: -server localhost to your own mail server
      • Note the use of -dsn "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\tmp\;Extended properties=Text;". This is a normal connection string that instructs NetMailBot on how to connect to the data.txt file. NOTE: You should have install latest ODBC drivers on your system should you encounter any ODBC errors.
      • -dbquery "SELECT * FROM data.txt" instructs NetMailBot to select all of the data from the file data.txt. The file data.txt is considered to be a psuedo database table.
      • -dbemailcolumn "email" instructs NetMailBot to use the data in the "column" named "email" to address the message to the data contained in that column for the current row.
      • The parameter -bodyfile "c:\tmp\body.txt" instructs NetMailBot to use the contents of the file body.txt as the email message body. In the file body.txt, you will see: "<<name>>=name,<<tracking>>=tracking". These are replacement ids which are explained next.
      • -dbreplacementids "<<firstName>>=firstName,<<lastName>>=lastName,<<tracking>>=tracking" instructs NetMailBot to replace the strings with double-angle brackets with the data contained in the mapped column for the current row. For example, in the message body, NetMailBot will replace the string <<firstName>> with the data contained in the column named "firstName".
      • -tofriendly instructs NetMailBot to replace "<<firstName>> <<lastName>>" with the data mapped to those replacement ids.
      • -personalize instructs NetMailBot to do make the replacements. Without this parameter specified, NetMailBot will not perform any replacements.
    5. Execute the batch file by double-clicking it in "My Computer".