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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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%
yup after this

if %errorlevel% == 0 goto succes

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.