mirror of https://github.com/CIRCL/AIL-framework
support non TSL SMTP servers
parent
053cc6dd27
commit
e9e3f17363
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue