Using -attachmentdir, -zip, and -filemask

This example demonstrates how to use the parameters -attachmentdir, -zip, and -filemask. The -attachmentdir parameter specifies a directory to retrieve files to attach from, the -zip parameter instructs NetMailBot to compress all of the files into a single attachment, and the -filemask parameter instructs NetMailBot to only work with the files that are of a certain file mask. 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 (attachmentdir.zip 1KB)
    The downloadable example is a zip file that contains 4 files:
    • watch_attachmentdir.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.

  • Steps
    1. Open Notepad and edit the batch file watch_attachmentdir.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
      • The parameter -attachmentdir "c:\tmp" specifies a directory to retrieve files to attach from.
      • The parameter -zip instructs NetMailBot to ZIP compress all of the attachments into one ZIP file and send it as the attachment.
      • The parameter -filemask "*.txt" instructs NetMailBot to only watch for files ending with ".txt" the files in the directory "c:\tmp". Only those files will be sent as attachments and deleted after the email is sent.
    2. Execute the batch file by double-clicking it in "My Computer".
    3. Check your email account Inbox for an email containing a single attachment named "attachment.zip"