diff --git a/apps/.DS_Store b/apps/.DS_Store deleted file mode 100644 index dc1d597..0000000 Binary files a/apps/.DS_Store and /dev/null differ diff --git a/apps/pushnotification/constants.py b/apps/pushnotification/constants.py deleted file mode 100644 index 4623b0c..0000000 --- a/apps/pushnotification/constants.py +++ /dev/null @@ -1,7 +0,0 @@ -from ...secret import MAILER_PW - -port = 465 # For starttls -smtp_server = "smtp.gmail.com" -sender_email = "noreply.ticketmasterbestseat@gmail.com" -subject = "Message from Ticketmaster Ticket Tracker" -app_password = MAILER_PW diff --git a/apps/pushnotification/smtp.py b/apps/pushnotification/smtp.py deleted file mode 100644 index b07b527..0000000 --- a/apps/pushnotification/smtp.py +++ /dev/null @@ -1,41 +0,0 @@ -from smtplib import SMTP_SSL -from ssl import create_default_context -from email.message import EmailMessage -from . import constants - - -def init_server(): - context = create_default_context() - server = SMTP_SSL(constants.smtp_server, constants.port, context=context) - return server - - -def server_login(server: SMTP_SSL, password: str): - return server.login(constants.sender_email, password) - - -def auth_server(server: SMTP_SSL): - server_login(server, constants.app_password) - - -server = init_server() -# auth_server(server) - - -def server_send_email(server: SMTP_SSL, receiver_emails: list[str], message: str): - em = EmailMessage() - em['From'] = constants.sender_email - em['To'] = receiver_emails - em['subject'] = constants.subject - - em.set_content(message) - return server.sendmail(constants.sender_email, receiver_emails, em.as_string()) - - -def send_email(receiver_emails: list[str], message: str): - try: - err = server_send_email(server, receiver_emails, message) - if err is not None: - raise Exception('could not send email to the receiver') - except Exception as ex: - print(ex) diff --git a/secret.py b/secret.py index e396b52..ed02f63 100644 --- a/secret.py +++ b/secret.py @@ -1,4 +1,3 @@ import os -CONN_SRV = os.environ.get('CONN_SRV') -MAILER_PW = os.environ.get('MAILER_PW', '') +CONN_SRV = os.environ.get('CONN_SRV') \ No newline at end of file