summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authordom96 <dominikpicheta@googlemail.com>2010-10-27 19:06:25 +0100
committerdom96 <dominikpicheta@googlemail.com>2010-10-27 19:06:25 +0100
commit8733886e5370e507e4179932b5658be2ee696e0f (patch)
tree9e8f055f0065fb277768ca66a2ce97cb751c4c27 /lib/pure
parent0879f0b0a7741dc725f1993b4490e00a13a640e0 (diff)
downloadNim-8733886e5370e507e4179932b5658be2ee696e0f.tar.gz
Added a close function to the ssl module.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/smtp.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pure/smtp.nim b/lib/pure/smtp.nim
index 88c05aaed..3490822b9 100644
--- a/lib/pure/smtp.nim
+++ b/lib/pure/smtp.nim
@@ -125,6 +125,7 @@ proc sendmail*(smtp: TSMTP, fromaddr: string,
   ## Sends `msg` from `fromaddr` to `toaddr`. 
   ## Messages may be formed using ``createMessage`` by converting the
   ## TMessage into a string.
+  ## This function sends the QUIT command when finished.
 
   smtp.debugSend("MAIL FROM:<" & fromaddr & ">\c\L")
   smtp.checkReply("250")
@@ -141,6 +142,10 @@ proc sendmail*(smtp: TSMTP, fromaddr: string,
   
   # quit
   smtp.debugSend("QUIT\c\L")
+  if not smtp.ssl:
+    smtp.sock.close()
+  else:
+    smtp.sslSock.close()
 
 proc createMessage*(mSubject, mBody: string, mTo, mCc: seq[string],
                 otherHeaders: openarray[tuple[name, value: string]]): TMessage =