Email api

You should probably merge #69 first, since it's included here.