More email fixes

Note that an error key can now be returned in the json response along with non-error values.