I'm sorry man, but I have no idea about how you can use JavaScript to access the shell of a Sun server because I never had anything else installed on my PC but Windows (XP & Vista)...
Why not using php to do that? There are lots and lots of good mail scripts out there you can use.
"When I am good, I am very good, but when I am bad, I am better."
[ Mae West ]