Sendmail refactor.

Summary:
Code duplication increases the likelihood of bugs,
makes it hard to read/reason about and also makes
updating it not fun.

Gmail/generic sendmail code was identical, therefore
restructure to eliminate the duplication.

Test Plan:
Tests pass as before.
imap/network/test_send.py added too

Reviewers: charles

Reviewed By: charles

Differential Revision: https://review.inboxapp.com/D412