Help with sending email result on failed transfer
Hello
I'm trying to get my transfers to send out an email after a failed transfer, but can't get it to work. I'm using
All the necessary files are in the WinSCP folder,
WinSCP log itself contains in the last lines:
Thanks in advance!
Robert
I'm trying to get my transfers to send out an email after a failed transfer, but can't get it to work. I'm using
Sendmail
and the example script part pasted over WinSCP auto-generated batch file code but to no avail. Couldn't find anything from google nor this forum, so please check and tell me what I'm missing here
@echo off "C:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="C:\WinSCP logid\WinSCP.log" /ini=nul ^ /command ^ "open sftp: Server =""" ^ "lcd Folder location" ^ "cd User" ^ "put *.csv" ^ "exit" set WINSCP_RESULT=%ERRORLEVEL% if %WINSCP_RESULT% equ 0 ( echo Success C:\Program Files (x86)\WinSCP\sendmail.exe -t < C:\Program Files (x86)\WinSCP\success_mail.txt exit /b 0 ) else ( echo Error! C:\Program Files (x86)\WinSCP\sendmail.exe -t < C:\Program Files (x86)\WinSCP\error_mail.txt exit /b 1 ) exit /b %WINSCP_RESULT%
success_mail
contains the same as example, just To
and From
replaced with my own (I think that's a need?) and sendmail.ini
modified to have my SMTP server and the account for it. Also enabled debugging and error logging but they aren't logging anything, so it feels like it isn't even doing anything past the transfer
WinSCP log itself contains in the last lines:
Script: exit Script: Exit code: 0 Sending Special code: 1
Robert