Update
This commit is contained in:
parent
639d3cdd4b
commit
9c76e06008
@ -9,6 +9,11 @@ import logging
|
|||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
class EmailSender:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DataCollector:
|
class DataCollector:
|
||||||
__CERT_PATH = "secrets/icl-iot-weather-firebase-adminsdk.json"
|
__CERT_PATH = "secrets/icl-iot-weather-firebase-adminsdk.json"
|
||||||
__API_KEY_PATH = "secrets/weather_api_key.txt"
|
__API_KEY_PATH = "secrets/weather_api_key.txt"
|
||||||
|
|||||||
16
email_playground.py
Normal file
16
email_playground.py
Normal 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)
|
||||||
Loading…
Reference in New Issue
Block a user