Log in into the machine and type the command:
which sh
Put this value as a first line, preceding it with th #! characters, like
#!/bin/sh
What is your shell version? Look carefully at the first lines after you connected via ssh to your router. It's similar to:
BusyBox v1.15.3 (2011-11-24 00:44:20 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.
You may want to log the output of the command for debug purposes:
#!/bin/sh
/opt/bin/curl --url "smtps://smtp.gmail.com:465" --ssl-reqd --mail-from "username@gmail.com" --mail-rcpt "username@gmail.com" --upload-file /mnt/mail.txt --user "username@gmail.com:password" --insecure 2>&1 | logger -t $0
It will log the output using syslog facility. If it happens you have no syslog installed, you can log the output to a file:
#!/bin/sh
/opt/bin/curl --url "smtps://smtp.gmail.com:465" --ssl-reqd --mail-from "username@gmail.com" --mail-rcpt "username@gmail.com" --upload-file /mnt/mail.txt --user "username@gmail.com:password" --insecure >> /tmp/mylogfile 2>&1
Also, make sure, the script has an executable attribute set:
chmod a+rx /path/to/your/script