JavaScript can't send mail on its own, you must be submitting the form data to a server-side script with sends out the mail, if you can write a server-side script with accepts the form data, inserts it into the database and then sends out the mail, then your problem is solved.
JavaScript is a client side scripting language, its capabilities are limited to the machine it is executed on (i.e. the client's browser), so you have to post the data to some server-side script.