-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathemailAnalysis.py
51 lines (35 loc) · 1.51 KB
/
emailAnalysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import smtplib
def send_email(subject, msg, RECIEVER_ADDRESS, PASSWORD, SENDER_ADDRESS, links, keywords):
try:
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()
server.login(SENDER_ADDRESS, PASSWORD)
# message = 'Subject: {}\n\nHey there! Here is your simplified lecture analysis. \n\nPlease email us at [email protected] if you have any questions or concerns.\n\n "{}" \n\nSincerely,\nThe AudioLec Team'.format(
# subject, msg)
videoString = ""
for video in links:
videoString = f'{videoString}{video}, '
keywordsList = []
for catergory, keyword in keywords.items():
keywordsList.append(keyword)
keywordsString = ""
for the_keywords in keywordsList:
for keyword in the_keywords:
keywordsString = f'{keywordsString}{keyword}, '
message = '''Subject: {}
Hey there! Here is your simplified lecture analysis.
Please email us at [email protected] if you have any questions or concerns.
Your transcript:
{}
Important topics to pay attention to:
{}
Videos to help you study:
{}
Sincerely,
The AudioLec Team\t'''.format(
subject, msg, keywordsString, videoString)
server.sendmail(SENDER_ADDRESS, RECIEVER_ADDRESS, message)
return "Success: Email sent!"
except:
return "Email failed to send. Try checking your password"