From 1d512b49867debfda7b601e8bbe01e402e79bdbf Mon Sep 17 00:00:00 2001 From: Brian Kanya Date: Thu, 12 Sep 2024 21:48:11 -0400 Subject: [PATCH] Use environment variable to set sender email of auth link emails (#907) Set sender email using `RESEND_EMAIL` environment variable for magic link sent via Resend API for authentication . It was previously hard-coded. This prevented hosting Khoj on other domains. Resolves #908 --- src/khoj/routers/email.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/khoj/routers/email.py b/src/khoj/routers/email.py index 5123cca2..9d0d3600 100644 --- a/src/khoj/routers/email.py +++ b/src/khoj/routers/email.py @@ -44,7 +44,12 @@ async def send_magic_link_email(email, unique_id, host): html_content = template.render(link=f"{host}auth/magic?code={unique_id}") resend.Emails.send( - {"sender": "noreply@khoj.dev", "to": email, "subject": "Your Sign-In Link for Khoj 🚀", "html": html_content} + { + "sender": os.environ.get("RESEND_EMAIL", "noreply@khoj.dev"), + "to": email, + "subject": "Your Sign-In Link for Khoj 🚀", + "html": html_content, + } )