Impossible due to browser security restrictions. As far as I know, this can be done in flash or java. Upcoming WebSockets will not help you either.
The best option is probably to call a script on your server that makes socket connections the final destination, i.e. an SMTP server, and then passes the data back to the client via HTTP.