Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
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.
 
Rather than use JavaScript, you can use -[UIApplication openURL:] to open a new mail in MobileMail.app. Keep in mind that is will terminate your own application.

Code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""mailto:user@aol.com?subject=test&message=test"]];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.