You could create a web service that sends a mail...
[WebMethod]
public void SendEmail(string subject, string message)
{
}
Then, you could call the web service from script to send the mail.
Have a look at jquery or other scripting frameworks which provide AJAX helper functionality for calling web service methods