Add mail function to script


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

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

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

Who is Participating?
yup after this

if %errorlevel% == 0 goto succes
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
Mr-BlackAuthor Commented:
where will this come in the script below
echo Backup van %vm% FAILED! >> %log%
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.