Kaydet (Commit) a2dce5a9 authored tarafından Jeroen Ruigrok van der Werven's avatar Jeroen Ruigrok van der Werven

Issue #4239: adjust email examples not to use connect() and terminate with

quit() and not close().
üst d567c38e
...@@ -45,4 +45,4 @@ s = smtplib.SMTP('localhost') ...@@ -45,4 +45,4 @@ s = smtplib.SMTP('localhost')
# sendmail function takes 3 arguments: sender's address, recipient's address # sendmail function takes 3 arguments: sender's address, recipient's address
# and message to send - here it is sent as one string. # and message to send - here it is sent as one string.
s.sendmail(me, you, msg.as_string()) s.sendmail(me, you, msg.as_string())
s.close() s.quit()
...@@ -106,9 +106,8 @@ must be running an SMTP server. ...@@ -106,9 +106,8 @@ must be running an SMTP server.
fp.close() fp.close()
else: else:
s = smtplib.SMTP() s = smtplib.SMTP()
s.connect()
s.sendmail(opts.sender, opts.recipients, composed) s.sendmail(opts.sender, opts.recipients, composed)
s.close() s.quit()
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -27,6 +27,5 @@ for file in pngfiles: ...@@ -27,6 +27,5 @@ for file in pngfiles:
# Send the email via our own SMTP server. # Send the email via our own SMTP server.
s = smtplib.SMTP() s = smtplib.SMTP()
s.connect()
s.sendmail(me, family, msg.as_string()) s.sendmail(me, family, msg.as_string())
s.close() s.quit()
...@@ -20,6 +20,5 @@ msg['To'] = you ...@@ -20,6 +20,5 @@ msg['To'] = you
# Send the message via our own SMTP server, but don't include the # Send the message via our own SMTP server, but don't include the
# envelope header. # envelope header.
s = smtplib.SMTP() s = smtplib.SMTP()
s.connect()
s.sendmail(me, [you], msg.as_string()) s.sendmail(me, [you], msg.as_string())
s.close() s.quit()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment