FileWatcher: Script to send emails using free tool blat.net

Discuss our other products here. Get help with installation and running, notify us of bugs, request new features and enhancements.

Moderators: DataMystic Support, Moderators

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

FileWatcher: Script to send emails using free tool blat.net

Postby DataMystic Support » Fri Aug 05, 2011 4:31 pm

See http://www.blat.net/ for the free download

Syntax: Full syntax: http://www.blat.net/syntax/syntax.html

Code: Select all

"<complete path\>blat.exe" -to test@test.com -from filewatcher@your.domain -subject "File arrived" -body "Please use it" -attach <filename>


Remember to put double quotes around the complete path to blat.exe!

Example for use in a batch file with File Watcher

Save as send_email.bat

Code: Select all

@echo off
rem Used with FileWatcher's command line and the %%FILE%% macro
rem Send mail with this file as the attachment
"<complete path\>blat.exe" -to test@test.com -from filewatcher@your.domain -subject "%1 arrived" -body "Please use it" -attach %1


Remember to put double quotes around the complete path to blat.exe in the batch file!

Command: <full path\>send_email.bat
Parameters: %FILE%

Example for use in a VBScript with File Watcher

Save as send_email.vbs

Code: Select all

    Option Explicit

    dim objArgs
    dim filename
    dim folder


    dim myRegExp
    set myRegExp = New RegExp
    myRegExp.IgnoreCase = False   'no need
    myRegExp.Global = False                             'replace once only
    myRegExp.Pattern = "\\[^\\]*$"               'match everything from the last \ to the end of the string

    dim WshShell

    Function ExecuteWithTerminalOutput(cmd)
                Set WshShell = WScript.CreateObject("WScript.Shell")
               
                'use this line to hide the window, and wait until the new process finishes
                'useful for debugging
                WshShell.Run cmd, 1, true
                'use this line below when debugging is not needed
    '            WshShell.Run cmd,0

                ExecuteWithTerminalOutput = 0
    End Function



    'Set a reference to the arguments
    Set objArgs = Wscript.Arguments

         for each filename in objArgs
               ExecuteWithTerminalOutput( chr(34) + "c:\program files\blat.exe" + chr(34) + " -to test@test.com -from filewatcher@your.domain -subject File_Arrived -body Please_Use_it -attach " + chr(34) + filename + chr(34) )

    next

    Set WshShell = Nothing
    Set myRegExp = Nothing
    Set objArgs = Nothing


Command: C:\Windows\System32\wscript.exe
Parameters: <full path\>send_email.vbs %FILE%
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Return to “FileWatcher, DirDate and other Support”

Who is online

Users browsing this forum: No registered users and 1 guest