diff --git a/bin/NotificationHelper.py b/bin/NotificationHelper.py index 6d396a5d..3f123d4a 100755 --- a/bin/NotificationHelper.py +++ b/bin/NotificationHelper.py @@ -73,3 +73,29 @@ def sendEmailNotification(recipient, term): except Exception as e: print str(e) + # raise e + elif ( + sender is not None and + sender_host is not None and + sender_port is not None + ): + try: + + server = smtplib.SMTP(sender_host, sender_port) + + mime_msg = MIMEMultipart() + mime_msg['From'] = sender + mime_msg['To'] = recipient + mime_msg['Subject'] = "AIL Term Alert" + + body = "New occurrence for term: " + term + mime_msg.attach(MIMEText(body, 'plain')) + + server.sendmail(sender, recipient, mime_msg.as_string()) + server.quit() + + except Exception as e: + print str(e) + # raise e + + diff --git a/bin/packages/config.cfg.sample b/bin/packages/config.cfg.sample index 5f409d96..8cb7a295 100644 --- a/bin/packages/config.cfg.sample +++ b/bin/packages/config.cfg.sample @@ -23,7 +23,9 @@ sentiment_lexicon_file = sentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon sender = sender@example.com sender_host = smtp.example.com sender_port = 1337 -sender_pw = securepassword + +# optional for using with authenticated SMTP over SSL +# sender_pw = securepassword ##### Flask ##### [Flask]