quit() and not close().
# 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()
fp.close()
else:
s = smtplib.SMTP()
- s.connect()
s.sendmail(opts.sender, opts.recipients, composed)
- s.close()
+ s.quit()
if __name__ == '__main__':
# Send the email via our own SMTP server.
s = smtplib.SMTP()
-s.connect()
s.sendmail(me, family, msg.as_string())
-s.close()
+s.quit()
# 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()