This code works, but you'll need to substitute valid credentials for it to do so (for simplicity's sake, I decided not to use a config file).
Not counting some struggles I had with installation, the original challenge took me about 45-50 minutes to complete. After figuring out syntax, the bulk of my time was spent figuring out how to select the email I want - primarily because I had some trouble selecting the appropriate table without any reliable classes or IDs.
All told, the entire thing took about 2 hours. Again, it was slower than I'd have liked, largely due to a lack of reliable CSS selectors - tabbing through the compose section seems much more reliable to me, but it took a bit for me to arrive there. The selector I used for the compose button isn't something I'm terribly happy about, but it was the most reliable method I could figure out.