Dry out GetTor's sendmail function

This patch refactors the sendmail function in GetTor to avoid code duplication.

https://gitlab.torproject.org/torproject/anti-censorship/gettor-project/gettor/-/merge_requests/6