Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add notification to user
  • Loading branch information
FrankQixiangGao committed Oct 20, 2022
commit f19318f4c35f104b64b0a0e15dcaecb361e0b292
Binary file added apps/.DS_Store
Binary file not shown.
32 changes: 32 additions & 0 deletions apps/pushnotification/smtp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import smtplib, ssl
from email.message import EmailMessage
import os
from dotenv import load_dotenv, find_dotenv


load_dotenv(find_dotenv())

port = 465 # For starttls
smtp_server = "smtp.gmail.com"
sender_email = "[email protected]"
receiver_email = ["[email protected]"]
password = "?????????" # The password is stored in local
subject = "Email from ticketmaster Best Seat App"

message = """\
Subject: Hi there

This message is sent from Python to give best seat info."""

em = EmailMessage()
em['From'] = sender_email
em['To'] = receiver_email
em['subject'] = subject

em.set_content(message)

context = ssl.create_default_context()
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server:
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, em.as_string())