Refactor send_email.py for better testability.

Signed-off-by: Daira Hopwood <daira@leastauthority.com>
Add a test for email header composition. refs #263

Signed-off-by: Daira Hopwood <daira@leastauthority.com>
Always send mail as UTF-8, avoiding duplicate Content-Type header. fixes #236

Signed-off-by: Daira Hopwood <daira@leastauthority.com>