mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-17 23:40:24 +00:00
mail only when some has birthday
This commit is contained in:
+5
-1
@@ -11,8 +11,8 @@ import sys
|
||||
from datetime import date
|
||||
from email.message import EmailMessage
|
||||
|
||||
from config import Config
|
||||
import db
|
||||
from config import Config
|
||||
|
||||
logging.basicConfig(level=Config.LOG_LEVEL, format="%(asctime)s [%(levelname)s] %(message)s")
|
||||
logger = logging.getLogger("mailer")
|
||||
@@ -181,6 +181,10 @@ def main() -> int:
|
||||
return 0
|
||||
|
||||
birthdays = fetch_todays_birthdays(conn)
|
||||
if not birthdays:
|
||||
logger.info("Keine Geburtstage heute, überspringe Mailversand")
|
||||
return 0
|
||||
|
||||
msg = build_message(birthdays)
|
||||
try:
|
||||
send_message(msg)
|
||||
|
||||
Reference in New Issue
Block a user