Need help with sending email notification after successful /failed uploads in batch script
Hi
I am new to writing batch files. I am looking to set up email notification if it failed or success for a upload. list below is my batch file.
The batch file works I just don't know how to setup the email. Please help! I have an IIS server that I can use as an smtp server to send emails. I just don't know how to add the code in the script above. When the upload exit code = 0 send success email. When exit code = 1 send fail email. I Have a batch file and my code inside is to call powershell run a ps1 script to send an email:
How do I make it work with the code above? thanks in advance.
I am new to writing batch files. I am looking to set up email notification if it failed or success for a upload. list below is my batch file.
@echo off "C:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="C:\FTPLogs\VCAL.log" /ini=nul ^ /command ^ "open sftp://******:******/ -hostkey=""*********""" ^ "synchronize remote E:\VCAL /Diagnostics_******/VCAL" ^ "exit" set WINSCP_RESULT=%ERRORLEVEL% if %WINSCP_RESULT% equ 0 ( echo Success ) else ( echo Error ) exit/b %WINSCP_RESULT%
Powershell.exe -executionpolicy remotesigned -File C:\bin\test\email.ps1