From 8e5cce42942202c05ff7c4bbe030d954bdee81d6 Mon Sep 17 00:00:00 2001 From: Blake Ridgway Date: Sat, 5 Apr 2025 20:21:29 -0500 Subject: [PATCH] feat: changed confirmation email from txt to html --- server.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server.py b/server.py index 143f4d8..a5534eb 100644 --- a/server.py +++ b/server.py @@ -16,15 +16,16 @@ def send_confirmation_email(email): SMTP_USER = os.getenv('SMTP_USER') SMTP_PASSWORD = os.getenv('SMTP_PASSWORD') - # Create the message for the unsubscribe_link = f"{request.url_root}unsubscribe?email={email}" + subject = 'Thanks for subscribing!' - body = ("Thanks for subscribing!\n\n" - "We're excited to share our journey with you.\n\n" - f"If you ever wish to unsubscribe, please click here." + + html_body = render_template( + 'confirmation_email.html', + unsubscribe_link=unsubscribe_link ) - msg = MIMEText(body, 'html', 'utf-8') + msg = MIMEText(html_body, 'html', 'utf-8') # Specify HTML msg['Subject'] = subject msg['From'] = SMTP_USER msg['To'] = email @@ -36,7 +37,7 @@ def send_confirmation_email(email): server.quit() except Exception as e: print(f"Failed to send email to {email}: {e}") - + @app.route("/") def index(): return render_template("index.html")