AiDeveloper1 commited on
Commit
2b7c513
·
verified ·
1 Parent(s): 725fc68

Update send_email.py

Browse files
Files changed (1) hide show
  1. send_email.py +4 -2
send_email.py CHANGED
@@ -14,7 +14,8 @@ templates = Jinja2Templates(directory="templates")
14
  async def send_rcs_email(to_email: str, direct_link: str):
15
  """Send an email with a direct link to view the generated RCS cards."""
16
  try:
17
-
 
18
  subject = "Your RCS Cards Have Been Generated"
19
 
20
  # Render the email template
@@ -26,7 +27,8 @@ async def send_rcs_email(to_email: str, direct_link: str):
26
  msg['From'] = from_email
27
  msg['To'] = to_email
28
 
29
- with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
 
30
  server.login(from_email, password)
31
  server.sendmail(from_email, to_email, msg.as_string())
32
 
 
14
  async def send_rcs_email(to_email: str, direct_link: str):
15
  """Send an email with a direct link to view the generated RCS cards."""
16
  try:
17
+ from_email = os.getenv("GMAIL_FROM_EMAIL")
18
+ password = os.getenv("GMAIL_APP_PASSWORD")
19
  subject = "Your RCS Cards Have Been Generated"
20
 
21
  # Render the email template
 
27
  msg['From'] = from_email
28
  msg['To'] = to_email
29
 
30
+ with smtplib.SMTP_SSL('smtp.gmail.com', 587) as server:
31
+ server.starttls()
32
  server.login(from_email, password)
33
  server.sendmail(from_email, to_email, msg.as_string())
34