diff --git a/Data_collector.py b/Data_collector.py index 76e150b..686873d 100755 --- a/Data_collector.py +++ b/Data_collector.py @@ -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" diff --git a/email_playground.py b/email_playground.py new file mode 100644 index 0000000..e2f083f --- /dev/null +++ b/email_playground.py @@ -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)