Ayman,
You'll find your answers to the questions of the 'is_valid' section in the ACS templating documentation. Read the Form API on your server in: /doc/acs-templating/api/form.html
The function send_mail can be called provided that it is defined in a tcl file that has been source. Tcl files in the tcl directory of packages get sourced at start up of your server so that would be a good place to put it. You can have the package manager (APM) watch tcl files in these directories so that the changes you make to these tcl file are automatically detected without having to restart the web server.
/Bart