Cannot connect lftp to IIS FTP with SSL

After experimenting with lftp I'm posting the solution using a bash script. So the bash script file contents would be

#!/bin/bash
USER='username'
PASS='password'
HOST='ftp.mydomain.com'
LOCAL_BACKUP_DIR='/backups'
REMOTE_DIR='/backupfiles'

lftp -u $USER,$PASS $HOST <<EOF
set ftp:ssl-protect-data true
set ftp:ssl-force true
set ssl:verify-certificate no
mirror -R -e "$LOCAL_BACKUP_DIR" "$REMOTE_DIR"
quit
EOF

Where changing the first part with the appropriate parameters of your ftp host, this script will take a mirror of all files in local directory to the remote one.

Since the remote host is a Windows IIS FTP Server with a self-signed certificate configured, I must note the need for the command set ssl:verify-certificate no in the script. Also though IIS/FTP user has to be entered in the form of HOST|USER e.g. ftp.mydomain.com|username, for some reason if this is set in lftp USER parameter the authentication fails. You have to ommit the HOST name and just set the username only... and that way it connects successfuly.