This example demonstrates how to use the watch directory features of NetMailBot. Specifically, a directory is watched for new files matching a specified file mask; 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 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.exe -to email@example.com -from firstname.lastname@example.org -server localhost -watchdir "c:\tmp\watch" -watchdelete -filemask "*.txt"