Last time I did JavaScript, it was
Code:
location.href = "mailto:user@aol.com?subject=test&message=test";
The mailto: URL on the iPhone opens the a new message form, it doesn't send an email. If you need to send an email without user interaction, you'll have to use a server somewhere to do that.