Watch and Move Files after Sending
Previous Topic  Next Topic 

Purpose

 

This example demonstrates how to use the watch directory features of NetMailBot. Specifically, a directory is watched for new files, when new files are found, they are sent to the recipient as an email attachment. After the email is sent, the files in the directory being watched are moved to the specified directory.  

 

NOTE: You should change the email addresses in the batch file to your own email address(es) before running a test. 

 

Prepared Example Files

 

 

The -watchdir parameter in NetMailBot uses full paths. We have assumed a particular path as shown in the batch file contents below. Therefore, download this file to C:\tmp on your hard drive or edit the -bodyfile parameter to reflect wherever you unzip the archive.

 

The archive contains one file and a directory containing three more files:

 

 

Batch File Contents

 

This is the content of the batch file:

 

netmailbot -to test@exclamationsoft.com -from test@exclamationsoft.com -server localhost -watchdir "c:\tmp\watch" -watchmoveto "c:\tmp"

 

Steps

 

  1. Unzip the WatchSendAndMove.zip file. This will produce a directory called "WatchSendAndMove". Open this directory.
  2. Open Notepad and edit the batch file "WatchSendAndMove.bat". Open Notepad and edit the batch file "MailMergeAccess2Tbls.bat". Note these important parameters used in the batch file:
  1. Invoke the batch file by double-clicking the icon or straight from the command line.
  2. Go to the directory "c:\tmp\watch" to ensure the files no longer exist there and check "c:\tmp" to ensure that the files now exist there.
  3. Check your email account for an email containing the file attachments.