birthday mail fullname when only 1 contact

This commit is contained in:
2026-08-22 10:09:51 +02:00
parent f307f103cf
commit 7e2b29a950
+4 -1
View File
@@ -69,6 +69,9 @@ def build_message(account_name: str, birthdays: list[dict], target_date: date |
msg.set_content("Heute hat niemand aus deinen Kontakten Geburtstag.")
return msg
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()}):", ""]
@@ -154,7 +157,7 @@ def build_message(account_name: str, birthdays: list[dict], target_date: date |
<tr>
<td style="padding:16px;">
<h1 style="font-size:20px;font-weight:600;color:#222;margin:0;">Geburtstage heute</h1>
<p style="font-size:13px;color:#666;margin:8px 0 16px 0;">{today.strftime('%d.%m.%Y')} · {len(birthdays)} Kontakte</p>
<p style="font-size:13px;color:#666;margin:8px 0 16px 0;">{today.strftime('%d.%m.%Y')} · {len(birthdays)} Kontakt{"e" if len(birthdays) != 1 else ""}</p>
<table width="100%" cellpadding="0" cellspacing="0">
{cards_html}
</table>