mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
support non TSL SMTP servers
This commit is contained in:
parent
053cc6dd27
commit
e9e3f17363
2 changed files with 29 additions and 1 deletions
|
@ -73,3 +73,29 @@ def sendEmailNotification(recipient, term):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print str(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 = sender@example.com
|
||||||
sender_host = smtp.example.com
|
sender_host = smtp.example.com
|
||||||
sender_port = 1337
|
sender_port = 1337
|
||||||
sender_pw = securepassword
|
|
||||||
|
# optional for using with authenticated SMTP over SSL
|
||||||
|
# sender_pw = securepassword
|
||||||
|
|
||||||
##### Flask #####
|
##### Flask #####
|
||||||
[Flask]
|
[Flask]
|
||||||
|
|
Loading…
Reference in a new issue