Add mail function to script

hello,

i want to add a mail function to a script that is used for vmware vcb.
if the backup failes i want to have a mail for this event. i did not create this script so can anywone help me with this. i want to use bmail to send the mail.

here is the script.

@echo off
set vcb="C:\Program Files (x86)\VMware\VMware Consolidated Backup Framework\vcbmounter.exe"
set user="blaat"
set pw="blaat"
set vc="server.domain.local"
set bdir=D:\vmbackup\
set vm=%1
set log=%bdir%%vm%.log

echo Start backup naar %bdir%%vm% >> %log%
echo %date% %time% > %log%
echo. >> %log%

echo Vmname       : %vm% >> %log%
echo backup dir   : %bdir%%vm% >> %log%
echo Logfile name : %log% >> %log%
echo. >> %log%

echo Huidige backup verwijderen... >> %log%
rd %bdir%%vm% /s /q >> %log%
echo. >> %log%

%vcb% -h %vc% -u %user% -p %pw% -a name:%vm% -r %bdir%%vm% -t fullvm -m san >> %log%

echo. >> %log%
echo %date% %time% >> %log%
echo. >> %log%

if %errorlevel% == 0 goto succes

:error
echo Backup van %vm% FAILED! >> %log%
goto end

:succes
echo Backup van %vm% klaar! >> %log%

:end
Mr-BlackAsked:
Who is Participating?
 
farjadarshadCommented:
yup after this

if %errorlevel% == 0 goto succes
0
 
farjadarshadCommented:
you can use "blat.exe" for this purpose syntax is as follows

blat -install  "smtp server" "email id"

blat -to "email id" -subject "xyz" -body "message of the mail"

hope this will help you
0
 
Mr-BlackAuthor Commented:
where will this come in the script below
echo Backup van %vm% FAILED! >> %log%
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.