If resend not enabled, don't send the welcome email

This commit is contained in:
sabaimran 2024-04-10 23:52:42 +05:30
parent d2f9c43c8e
commit 5d1dd3e2b7

View file

@ -20,10 +20,18 @@ if not RESEND_API_KEY:
logger.info("RESEND_API_KEY not set - email sending disabled")
def is_resend_enabled():
return bool(RESEND_API_KEY)
resend.api_key = RESEND_API_KEY
async def send_welcome_email(name, email):
if not is_resend_enabled():
logger.debug("Email sending disabled")
return
template = env.get_template("welcome.html")
html_content = template.render(name=name if not is_none_or_empty(name) else "you")