From 7e2b29a950577085b7f19bffd3e0ea6877ae9294 Mon Sep 17 00:00:00 2001 From: Stefan Koelle Date: Sat, 22 Aug 2026 10:09:51 +0200 Subject: [PATCH] birthday mail fullname when only 1 contact --- src/mailer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mailer.py b/src/mailer.py index 4f800a8..7c8e2a3 100644 --- a/src/mailer.py +++ b/src/mailer.py @@ -69,7 +69,10 @@ def build_message(account_name: str, birthdays: list[dict], target_date: date | msg.set_content("Heute hat niemand aus deinen Kontakten Geburtstag.") return msg - msg["Subject"] = f"Geburtstage heute ({today.isoformat()}): {len(birthdays)}" + if len(birthdays) == 1: + msg["Subject"] = f"Geburtstage heute ({today.isoformat()}): {birthdays[0]['full_name']}" + else: + msg["Subject"] = f"Geburtstage heute ({today.isoformat()}): {len(birthdays)}" plain_lines = [f"Heutige Geburtstage ({today.isoformat()}):", ""] for b in birthdays: @@ -154,7 +157,7 @@ def build_message(account_name: str, birthdays: list[dict], target_date: date |

Geburtstage heute

-

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

+

{today.strftime('%d.%m.%Y')} · {len(birthdays)} Kontakt{"e" if len(birthdays) != 1 else ""}

{cards_html}