--- /usr/lib/python2.4/smtplib.py 2005-05-01 18:56:45.000000000 -0500 +++ smtplib.py 2005-06-08 15:20:06.000000000 -0500 @@ -224,6 +224,7 @@ helo_resp = None ehlo_resp = None does_esmtp = 0 + does_smtps = 0 def __init__(self, host = '', port = 0, local_hostname = None): """Initialize a new instance. @@ -264,6 +265,19 @@ """ self.debuglevel = debuglevel + + def set_does_smtps(self): + """Set connection type to an ssl wrapped connection + + Some clients and/or servers require a fully wrapped SSL connection + instead of a standard TLS session. This will set the socket + to a full SSL connection from within the initial connection. + This service is usually offered on port 465. + + """ + + self.does_smtps = True + def connect(self, host='localhost', port = 0): """Connect to a host on a given port. @@ -340,7 +354,13 @@ """ resp=[] if self.file is None: - self.file = self.sock.makefile('rb') + if self.does_smtps: + sslobj = socket.ssl(self.sock, None, None) + self.sock = SSLFakeSocket(self.sock, sslobj) + self.file = SSLFakeFile(sslobj) + else: + self.file = self.sock.makefile('rb') + while 1: line = self.file.readline() if line == '': @@ -734,3 +754,4 @@ server.set_debuglevel(1) server.sendmail(fromaddr, toaddrs, msg) server.quit() +