This commit is contained in:
Max 2020-10-19 16:22:08 +01:00
parent 639d3cdd4b
commit 9c76e06008
2 changed files with 21 additions and 0 deletions

View File

@ -9,6 +9,11 @@ import logging
logging.basicConfig(level=logging.INFO)
class EmailSender:
def __init__(self):
pass
class DataCollector:
__CERT_PATH = "secrets/icl-iot-weather-firebase-adminsdk.json"
__API_KEY_PATH = "secrets/weather_api_key.txt"

16
email_playground.py Normal file
View File

@ -0,0 +1,16 @@
import smtplib
import ssl
port = 465 # For SSL
smtp_server = "smtp.gmail.com"
sender_email = "iotdemax@gmail.com" # Enter your address
receiver_email = "mh2817@ic.ac.uk" # Enter receiver address
__PASSWORD_PATH = "secrets/email_password.txt"
with open(__PASSWORD_PATH, "r") as password_file:
password = password_file.read()
message = "Testing email..."
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, port, context=context) as server:
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)