Ok, good that you made it working. Though I cannot imagine how moving the command to another batch file can make any difference.
- martin
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
call "C:\sendmail\success.bat"
) else (
echo Error!
call "C:\sendmail\failure.bat"
)
exit /b %WINSCP_RESULT%
C:\sendmail\sendmail.exe -F WinSCP -f SENDER@DOMAIN.ABC RECEIVER@DOMAIN.ABC < C:\sendmail\success_mail.mail
exit /b 0
smtp_ssl
set to none. Rest are commented out
sendmail.exe < ....
before but thought that maybe adding the absolute path would help. Made a new folder for it, which did absolutely 0.
"C:\Program Files (x86)\WinSCP\sendmail.exe" -t < "C:\Program Files (x86)\WinSCP\success_mail.txt"
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
Script: exit
Script: Exit code: 0
Sending Special code: 1