[gsoc-admin] email: Implement send_mail



commit 6dd4d38946a1930704b62639355b58117e7d65ba
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date:   Wed Aug 12 21:14:54 2015 +0200

    email: Implement send_mail

 maillib/email.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/maillib/email.py b/maillib/email.py
index fca8bd4..437ab86 100755
--- a/maillib/email.py
+++ b/maillib/email.py
@@ -1,10 +1,20 @@
 #!/usr/bin/env python3
 
 import datetime
+import smtplib
+from email.mime.text import MIMEText
 
 
 def send_mail(text, sender, recipient, cc, bcc):
-    raise NotImplementedError
+    mimobj = MIMEText(text)
+    mimobj['From'] = sender
+    mimobj['To'] = recipient
+    mimobj['CC'] = cc
+    mimobj['BCC'] = bcc
+
+    localhost = smtplib.SMTP('localhost')
+    localhost.send_message(mimobj)
+    localhost.quit()
 
 
 class Contact:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]