Patchwork [2,of,4] py3: call SMTP.docmd() with an str

login
register
mail settings
Submitter Denis Laxalde
Date Oct. 10, 2019, 7:47 p.m.
Message ID <134382b8c782147ab2fa.1570736849@marimba>
Download mbox | patch
Permalink /patch/42194/
State Accepted
Headers show

Comments

Denis Laxalde - Oct. 10, 2019, 7:47 p.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1570734334 -7200
#      Thu Oct 10 21:05:34 2019 +0200
# Node ID 134382b8c782147ab2fab155ebe79aa8df3b435c
# Parent  55a0f0c84fdc2170047ea99f71bfac60e3ea4b50
py3: call SMTP.docmd() with an str

Otherwise, this always returns (502, '5.5.2 Error: command not
recognized').

Patch

diff --git a/mercurial/mail.py b/mercurial/mail.py
index 675207a..519cc3b 100644
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -52,7 +52,7 @@  class STARTTLS(smtplib.SMTP):
         if not self.has_extn("starttls"):
             msg = b"STARTTLS extension not supported by server"
             raise smtplib.SMTPException(msg)
-        (resp, reply) = self.docmd(b"STARTTLS")
+        (resp, reply) = self.docmd("STARTTLS")
         if resp == 220:
             self.sock = sslutil.wrapsocket(
                 self.sock,