Batch Script email on success or failure

I'm stuck trying to get the script below to send the email on success or failure. It works otherwise. When the script runs it throws the following error for the send mail portion only. Any help with this would be appreciated.

Error:
0 1242930762 2 0 0 4556 4972 0 backupserver.domain.net smtpmail 2 %s 1 0 48 protocol failure; got 501 5.5.4 Invalid Address



Script:
rem @echo off

REM This script should be run on the Networker server.

setlocal

set MAILSERVER=server.domain.net
set RECIEPENTS=user@domain.com
set SERVER=backupserver.domain.net
set DESTPOOL="Backup Clone"
set DAILY1="Daily Backup Clone"
set LOG=daily_clone.log


echo Cloning started at %DATE% %TIME% >> %LOG%

nsrclone -b %DESTPOOL% -s %SERVER% -y month -w month -S -g %DAILY1% -e now -C 1 >> %LOG% 2>&1
if %ERRORLEVEL% GTR 0 (
    echo ERROR: Cloning of %DAILY1% terminated with errors %DATE% %TIME% >> %LOG%
    smtpmail -h %MAILSERVER% -s "ERROR: Cloning of %DAILY1% terminated with errors" -f Networker %RECIEPENTS% < %LOG%
) else (
   smtpmail -h %MAILSERVER% -s "Cloning of %DAILY1% Completed Succesfully" -f "Networker" %RECIEPENTS%
)

:end
    del %LOG%.09
    move %LOG%.08 %LOG%.09
    move %LOG%.07 %LOG%.08
    move %LOG%.06 %LOG%.07
    move %LOG%.05 %LOG%.06
    move %LOG%.04 %LOG%.05
    move %LOG%.03 %LOG%.04
    move %LOG%.02 %LOG%.03
    move %LOG%.01 %LOG%.02
    move %LOG%.00 %LOG%.01
    move %LOG% %LOG%.00
   
endlocal
scobb13Asked:
Who is Participating?
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.

Lee W, MVPTechnology and Business Process AdvisorCommented:
It would seem that your feeding it an invalid recipient.  Have you run the mail command outside the script?  Or considered using BLAT instead (I'm not familiar with SMTPMAIL.
0
scobb13Author Commented:
Yes. It works if it is run outside the script.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
And since you've commented out echo off, what does the line display when it runs in the script?  Copy and paste it to another window and run it from there.
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

scobb13Author Commented:
Does the same thing. I think it may have something to do with the " around the "DAILY1" variable.
0
KorbusCommented:
you put quotes around "networker" in the second smtpmail (success) call, but not the first (failure) call?
0
scobb13Author Commented:
Quotes around networker didn't change anything. I'm pretty sure it's the quotes pulling to the variables into the mail subject.
0
scobb13Author Commented:
was the quotes from the set command.
0

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
Email Protocols

From novice to tech pro — start learning today.