From 8aa3f364cb5fe84c3be46cd6bbdf8738ea1a3053 Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Thu, 16 May 2024 20:43:29 +0200 Subject: [PATCH] support new format of confirmed mail --- src/mail/mail_confirmation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mail/mail_confirmation.py b/src/mail/mail_confirmation.py index a48d541..5c65dc6 100755 --- a/src/mail/mail_confirmation.py +++ b/src/mail/mail_confirmation.py @@ -21,6 +21,8 @@ HERMES_EMAIL = "no-reply@hermes.com" date_format = "%d-%b-%Y" # DD-Mon-YYYY e.g., 3-Mar-2014 +FRENCH_CONFIRMED_MESSAGE = "Nous avons le plaisir de vous confirmer votre rendez-vous" + class MailConfirmationReader(): def __init__(self, login, password): @@ -194,13 +196,17 @@ def find_confirmation_contacts_mail_list(mail_list): for mail in mails_messages: message_body = mail.body for item in successful_items: - if item.id in message_body and item.id != "welcome" and len(item.id) > 0: + if item.id in message_body and item.id != "welcome" and len(item.id) > 0: # 如果邮件中包含有ID item.message = message_body accepted_appointment_list.append(item) elif "10:30" in message_body and ( item.mail == mail.mail_address or item.mail in message_body) and len(item.id) > 0: item.message = message_body accepted_appointment_list.append(item) + elif FRENCH_CONFIRMED_MESSAGE in message_body and ( + item.mail == mail.mail_address or item.mail in message_body) and len(item.id) > 0: + item.message = message_body + accepted_appointment_list.append(item) elif "11:30" in message_body and ( item.mail == mail.mail_address or item.mail in message_body) and len(item.id) > 0: item.message = message_body