diff --git a/padelnomics/src/padelnomics/worker.py b/padelnomics/src/padelnomics/worker.py index 2cceb31..b86a64b 100644 --- a/padelnomics/src/padelnomics/worker.py +++ b/padelnomics/src/padelnomics/worker.py @@ -12,6 +12,46 @@ from .core import config, execute, fetch_all, init_db, send_email HANDLERS: dict[str, callable] = {} +def _email_wrap(body: str) -> str: + """Wrap email body in a branded layout with inline CSS.""" + return f"""\ + + +
+ +| + + |
| ' + f'' + f'{label} |
Click the link below to sign in:
- -This link expires in {config.MAGIC_LINK_EXPIRY_MINUTES} minutes.
-If you didn't request this, you can safely ignore this email.
- """ - + + body = ( + f'Click the button below to sign in. This link expires in " + f"{config.MAGIC_LINK_EXPIRY_MINUTES} minutes.
" + f"{_email_button(link, 'Sign In')}" + f'If the button doesn\'t work, copy and paste this URL into your browser:
' + f'{link}
' + f'If you didn\'t request this, you can safely ignore this email.
' + ) + await send_email( to=payload["email"], subject=f"Sign in to {config.APP_NAME}", - html=html, + html=_email_wrap(body), ) @task("send_welcome") async def handle_send_welcome(payload: dict) -> None: """Send welcome email to new user.""" - html = f""" -Thanks for signing up. We're excited to have you.
- - """ - + body = ( + f'Thanks for signing up. You're all set to start planning your padel business.
" + f'{_email_button(f"{config.BASE_URL}/dashboard", "Go to Dashboard")}' + ) + await send_email( to=payload["email"], subject=f"Welcome to {config.APP_NAME}", - html=html, + html=_email_wrap(body), )