diff -r a1801ee97840 -r 54b06bec8914 mercurial/mail.py --- a/mercurial/mail.py Thu Oct 10 21:05:34 2019 +0200 +++ b/mercurial/mail.py Thu Oct 10 21:30:44 2019 +0200 @@ -61,7 +61,7 @@ ui=self._ui, serverhostname=self._host, ) - self.file = smtplib.SSLFakeFile(self.sock) + self.file = self.sock.makefile("rb") self.helo_resp = None self.ehlo_resp = None self.esmtp_features = {}