You could try something like this:
Code:
#!/bin/bash
# <<EOF allows for passing lots of commands
ftp ftp.sample.com <<EOF
username
password
lcd localdir
cd remotedir
put localfile
bye
EOF
# $? reads the exit code of the last program
if ! [ "$?" = "0" ]
then mail -s subject designated_unix_user <<EOF
Hi there, seems like the backup went wrong at $( date ).
Greets,
the backup daemon
EOF
fi
It is not perfect, I didn't test it as a whole. I especially couldn't pass the password this way for some reason, but I guess there are other ways to pass the credentials (f.i. with a ftp://username:password@host URL, check man ftp) if this doesn't work at your place either. Just play around a bit.