is this going to be solved by writing it in javascript though?
Looking at the sample code in this page:
Mail.outgoingMessages.whose({subject:'JavaScript'})
is doesn't look much better.