diff --git a/src/mailer.py b/src/mailer.py index 056b091..7c19e21 100644 --- a/src/mailer.py +++ b/src/mailer.py @@ -88,37 +88,49 @@ def build_message(birthdays: list[dict], target_date: date | None = None) -> Ema age = fmt_birthday_age(b["birthday"], today) age_str = f' · {age} Jahre' if age is not None else "" contact_link = f"{Config.WEB_URL.rstrip('/')}/contacts/{b['id']}" if Config.WEB_URL else "" - link_start = f'' if contact_link else "" - link_end = "" if contact_link else "" is_today = b["birthday"].month == today.month and b["birthday"].day == today.day - card_bg = "#fff3cd" if is_today else "#fff" + card_bg = "#fff3cd" if is_today else "#ffffff" + border_color = "#ffc107" if is_today else "#e0e0e0" org_html = f'
{b["organization"]}
' if b.get("organization") else "" - photo_html = "" + photo_cell = "" if b.get("photo_url"): - photo_html = f'' - cards_html += f""" - - - {link_start} -
-
+ photo_cell = f'' + if contact_link: + content_html = f"""
{b["full_name"]}
{org_html}
🎂 {date_str}{age_str}
-
- {photo_html} -
- {link_end} + """ + else: + content_html = f"""
{b["full_name"]}
+ {org_html} +
🎂 {date_str}{age_str}
""" + cards_html += f""" + + + + + + {photo_cell} + +
+ {content_html} +
- - """ + """ link_html = "" if Config.WEB_URL: link_html = f""" - - Alle Kontakte ansehen + + + + + +
+ Alle Kontakte ansehen +
""" @@ -127,16 +139,21 @@ def build_message(birthdays: list[dict], target_date: date | None = None) -> Ema + + + -
+ -
-

Geburtstage heute

-

{today.strftime('%d.%m.%Y')} · {len(birthdays)} Kontakte

+
+

Geburtstage heute

+

{today.strftime('%d.%m.%Y')} · {len(birthdays)} Kontakte