Call send_expiry_notification with single arguments instead of tuples

This commit is contained in:
2026-01-22 17:57:00 +01:00
parent 04114ab659
commit 9860954cf7
2 changed files with 21 additions and 12 deletions

View File

@@ -70,7 +70,9 @@ class EmailService:
email,
hostname,
last_ipv4,
last_ipv4_update,
last_ipv6,
last_ipv6_update,
expiry_ttl
):
"""
@@ -86,20 +88,19 @@ class EmailService:
Returns:
True if sent successfully.
"""
expired = ""
if last_ipv4 and last_ipv4_update:
expired += f"IPv4 address: {last_ipv4} (last update: {last_ipv4_update})\n"
if last_ipv6 and last_ipv6_update:
expired += f"IPv6 address: {last_ipv6} (last update: {last_ipv6_update})\n"
subject = f"DDNS hostname expired: {hostname}"
body = f"""Your dynamic DNS entry has expired due to inactivity.
Hostname: {hostname}
"""
if last_ipv4:
ip = last_ipv4[0]
last_update = datetime_str(last_ipv4[1])
body += f"IPv4 address: {ip} (last update: {last_update})\n"
if last_ipv6:
ip = last_ipv6[0]
last_update = datetime_str(last_ipv6[1])
body += f"IPv6 address: {ip} (last update: {last_update})\n"
body += f"""Expiry TTL: {expiry_ttl} seconds
{expired}
Expiry TTL: {expiry_ttl} seconds
The DNS records have been removed. Update your client to restore them.
"""