wip. email works. just need to cleanup, rebase and PR.