]> granicus.if.org Git - python/commitdiff
Issue #4239: adjust email examples not to use connect() and terminate with
authorJeroen Ruigrok van der Werven <asmodai@in-nomine.org>
Sat, 25 Apr 2009 12:49:10 +0000 (12:49 +0000)
committerJeroen Ruigrok van der Werven <asmodai@in-nomine.org>
Sat, 25 Apr 2009 12:49:10 +0000 (12:49 +0000)
quit() and not close().

Doc/includes/email-alternative.py
Doc/includes/email-dir.py
Doc/includes/email-mime.py
Doc/includes/email-simple.py

index d941323937647b5e5814b605c8b7cbf9c5b0ab3e..82e3ffa3b3a09a0bfa9cef66ccdb208975c06f91 100644 (file)
@@ -45,4 +45,4 @@ s = smtplib.SMTP('localhost')
 # sendmail function takes 3 arguments: sender's address, recipient's address
 # and message to send - here it is sent as one string.
 s.sendmail(me, you, msg.as_string())
-s.close()
+s.quit()
index c04f57d6414cb9a580fedf0c3611c2fee1ae5776..e67de61dcfbf0e9e0d97746a3ec137032b4c3714 100644 (file)
@@ -106,9 +106,8 @@ must be running an SMTP server.
         fp.close()
     else:
         s = smtplib.SMTP()
-        s.connect()
         s.sendmail(opts.sender, opts.recipients, composed)
-        s.close()
+        s.quit()
 
 
 if __name__ == '__main__':
index 5097253749a4a0d17b3ef1ed78e99e227ba47638..f64df83b4d89e8a4d05fa5c02bb2fb7ab0d14cce 100644 (file)
@@ -27,6 +27,5 @@ for file in pngfiles:
 
 # Send the email via our own SMTP server.
 s = smtplib.SMTP()
-s.connect()
 s.sendmail(me, family, msg.as_string())
-s.close()
+s.quit()
index 44152a4839c92062367cea2b4bbf7c1815fe9ec6..689511e4bb9f8cafcea13ac8808644cfe9a7b456 100644 (file)
@@ -20,6 +20,5 @@ msg['To'] = you
 # Send the message via our own SMTP server, but don't include the
 # envelope header.
 s = smtplib.SMTP()
-s.connect()
 s.sendmail(me, [you], msg.as_string())
-s.close()
+s.quit()