use the SMTP library as advertised
[plcapi.git] / PLC / sendmail.py
index 86cee36..d4a0a2a 100644 (file)
@@ -93,10 +93,10 @@ def sendmail(api, To, Subject, Body, From=None, Cc=None, Bcc=None):
 
     s = SMTP()
     s.connect()
-    s.close()
     rejected = s.sendmail(
         from_addrs[0], to_addrs,
         msg.as_string(), rcpt_options=["NOTIFY=NEVER"])
+    s.quit()
 
     if rejected:
         raise PLCAPIError("Error sending message to "