loopcount 10 :connect_loop ftplogon "mysite" iferror= $error_success goto connected pause /for=60 loopto connect_loop ;; Connection attempts failed 10 times CREATEMAIL "Script Notifier" "noreply@mycompany.com" "Connection failed" "FTP server appears to be down" "" sendmail "smtp.mycompany.com" "Sys Admin" "sysadmin@mycompany.com" EXIT :connected ;; Connection worked -- continue script