Reputation: 1304
first time I've used blat and it appears to work fine however its sending two emails for every email I intend to send. Script excerpt is below:
::If we have a problem we email from here
CALL :checkForFailures
:checkForFailures
IF EXIST %ERROR_FILE% CALL :email & EXIT /B 1
::pause
GOTO :eof
:email
IF %TOLOG%==Y (
BLAT -f [email protected] -to [email protected] -server myserver -subject "subject text" -body "Body text" -attacht
::%PROBLEM_LIST% >> %LOGFILE%
)
GOTO :eof
I've tried running this with and without output to the logfile. runs fine from the cmd prompt but just issues within this script.
Thanks for the help
Upvotes: 2
Views: 948
Reputation: 53111
how is the entire thing getting triggered? is it a file modify/create flag that's doing it? sometimes those kinds of triggers can be double counted because of the way the OS handles the modified/create triggers.
Upvotes: 0
Reputation: 354606
Maybe you should stop your batch file after your call to :checkForFailures
:
::If we have a problem we email from here
CALL :checkForFailures
goto :eof
:checkForFailures
...
Otherwise you call it once, and execution continues directly after the call
. In which case it runs the :checkForFailures
subroutine again and sends out a second mail.
Upvotes: 2