diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -219,6 +219,7 @@ ehlo_msg = "ehlo" ehlo_resp = None does_esmtp = 0 + default_port = SMTP_PORT def __init__(self, host='', port=0, local_hostname=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): @@ -234,7 +235,6 @@ """ self.timeout = timeout self.esmtp_features = {} - self.default_port = SMTP_PORT if host: (code, msg) = self.connect(host, port) if code != 220: @@ -741,13 +741,14 @@ are also optional - they can contain a PEM formatted private key and certificate chain file for the SSL connection. """ + default_port = SMTP_SSL_PORT + def __init__(self, host='', port=0, local_hostname=None, keyfile=None, certfile=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.keyfile = keyfile self.certfile = certfile SMTP.__init__(self, host, port, local_hostname, timeout) - self.default_port = SMTP_SSL_PORT def _get_socket(self, host, port, timeout): if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) @@ -776,8 +777,9 @@ authentication, but your mileage might vary.""" ehlo_msg = "lhlo" + default_port = LMTP_PORT - def __init__(self, host = '', port = LMTP_PORT, local_hostname = None): + def __init__(self, host = '', port = 0, local_hostname = None): """Initialize a new instance.""" SMTP.__init__(self, host, port, local_hostname)