diff --git a/atomstrom.py b/atomstrom.py index 63ddb45..cad04e6 100755 --- a/atomstrom.py +++ b/atomstrom.py @@ -13,6 +13,7 @@ import hn import html2text import ConfigParser import smtplib +from email.mime.text import MIMEText from optparse import OptionParser Base = declarative_base() @@ -133,6 +134,14 @@ class Entry(Base): def send_mail(sender, receiver, subject, body): print 'sending to %s: %s' % (receiver.decode('latin-1'), subject.decode('latin-1')) + mail = MIMEText(body) + mail['From'] = sender + mail['To'] = receiver + mail['Subject'] = subject + mailserver = smtplib.SMTP('localhost') + mailserver.sendmail(sender, [receiver], mail.as_string()) + mailserver.quit() + def get_entry_text(entry): if entry.readability: