-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshare.py
32 lines (25 loc) · 799 Bytes
/
share.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
import os
import yagmail
from scripts.definitions import *
# extract Gmail token from environment
try:
GMAIL_PWD = os.environ["GMAIL_PWD"]
except KeyError:
GMAIL_PWD = "Token not available!"
def share_report():
'''
This function send out the created datapane report for each program
'''
file_path = ['weekly_data/' + program + '_weekly_flood_status.csv' for program in programs]
yag = yagmail.SMTP("[email protected]",
GMAIL_PWD)
# Adding Content and sending it
yag.send(recipients, # defined in definitions.py
f"Weekly BirdSense Reports",
contents = email_content,
attachments = file_path
)
yag.close()
print('email sent')
# Step 5: send email
share_report()