feat(email): add branded message notification email builder
This commit is contained in:
parent
36a7fbc5ea
commit
d64447627a
@ -381,6 +381,41 @@ def _email_v3_wrap(title: str, subtitle: str, content_html: str) -> str:
|
||||
</html>'''
|
||||
|
||||
|
||||
def build_message_notification_email(sender_name: str, subject: str, content_preview: str, message_url: str, settings_url: str) -> tuple:
|
||||
"""Build branded email for message notification. Returns (html, text)."""
|
||||
subject_html = f'<p style="margin:0 0 16px; color:#475569; font-size:15px;"><strong>Temat:</strong> {subject}</p>' if subject else ''
|
||||
|
||||
content_html = f'''
|
||||
<p style="margin:0 0 20px; color:#1e293b; font-size:16px;">
|
||||
<strong>{sender_name}</strong> wysłał(a) Ci wiadomość na portalu Norda Biznes.
|
||||
</p>
|
||||
|
||||
{subject_html}
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="background:#f8fafc; border-left:4px solid #3b82f6; border-radius:4px; margin-bottom:24px;">
|
||||
<tr><td style="padding:16px;">
|
||||
<p style="margin:0; color:#374151; font-size:14px;">{content_preview}</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom:24px;">
|
||||
<tr><td align="center" style="padding:8px 0;">
|
||||
<a href="{message_url}" style="display:inline-block; padding:14px 36px; background-color:#3b82f6; color:#ffffff; text-decoration:none; border-radius:8px; font-size:15px; font-weight:600;">Przeczytaj wiadomość</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<p style="margin:0; color:#94a3b8; font-size:12px; text-align:center;">
|
||||
Możesz wyłączyć powiadomienia e-mail w <a href="{settings_url}" style="color:#2563eb;">ustawieniach prywatności</a>.
|
||||
</p>
|
||||
'''
|
||||
|
||||
html = _email_v3_wrap('Nowa wiadomość', f'od {sender_name}', content_html)
|
||||
|
||||
text = f'{sender_name} wysłał(a) Ci wiadomość na portalu Norda Biznes. Odczytaj: {message_url}'
|
||||
|
||||
return html, text
|
||||
|
||||
|
||||
def send_password_reset_email(email: str, reset_url: str) -> bool:
|
||||
"""Send password reset email."""
|
||||
subject = "Reset hasła - Norda Biznes Partner"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user