feat: changed confirmation email from txt to html

This commit is contained in:
Blake Ridgway 2025-04-05 20:21:29 -05:00
parent 14cac6177f
commit 8e5cce4294

View file

@ -16,15 +16,16 @@ def send_confirmation_email(email):
SMTP_USER = os.getenv('SMTP_USER') SMTP_USER = os.getenv('SMTP_USER')
SMTP_PASSWORD = os.getenv('SMTP_PASSWORD') SMTP_PASSWORD = os.getenv('SMTP_PASSWORD')
# Create the message for the
unsubscribe_link = f"{request.url_root}unsubscribe?email={email}" unsubscribe_link = f"{request.url_root}unsubscribe?email={email}"
subject = 'Thanks for subscribing!' subject = 'Thanks for subscribing!'
body = ("Thanks for subscribing!\n\n"
"We're excited to share our journey with you.\n\n" html_body = render_template(
f"If you ever wish to unsubscribe, please click <a href='{unsubscribe_link}'>here</a>." '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['Subject'] = subject
msg['From'] = SMTP_USER msg['From'] = SMTP_USER
msg['To'] = email msg['To'] = email
@ -36,7 +37,7 @@ def send_confirmation_email(email):
server.quit() server.quit()
except Exception as e: except Exception as e:
print(f"Failed to send email to {email}: {e}") print(f"Failed to send email to {email}: {e}")
@app.route("/") @app.route("/")
def index(): def index():
return render_template("index.html") return render_template("index.html")