Watch a Directory, Specify Filemask, and Delete Files After Sending

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
deleted. NOTE: You should change the email addresses in the downloadable
batch 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 (filemask.zip 1KB)
The downloadable example is a zip file that contains 4 files:

watch_filemask.bat - The batch file that will instruct NetMailBot to send the email message.

attach1.txt - A file to attach

attach2.log - A file that should not be attached

attach3.txt - A file to attach

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. Ensure that the attach*.* files are all in the directory
c:\tmp\watch. If they are not, create a text file with Notepad and save it in that
directory.

The parameter -watchdir "c:\tmp\watchdir" instructs
NetMailBot to watch the directory "c:\tmp\watchdir" for files to send as attachments
to the -to email address.

The parameter -watchdelete instructs NetMailBot to
delete the files in the directory "c:\tmp\watchdir" after the email is sent.

The parameter -filemask "*.txt" instructs NetMailBot to
only watch for files ending with ".txt" the files in the directory "c:\tmp\watchdir".
Only those files will be sent as attachments and deleted after the email is sent.

Execute the batch file by double-clicking it in
"My Computer".

Go to the directory "c:\tmp\watchdir" to ensure the
files attach1.txt and attach3.txt have been deleted, but attach.log has not.

Close the DOS command window by clicking on the Close
button or by pressing CTRL-C.