prepare mail inteface

This commit is contained in:
Tom Irgang 2023-05-04 20:50:45 +02:00
parent 61e543b1b0
commit 1c84404e46

View file

@ -20,6 +20,7 @@ def send_message_notification(message: Message, guest: Guest):
text = f'Hallo,\n' text = f'Hallo,\n'
f'der Gast {guest.name} ({guest.mail}) hat folgende Nachricht gesendet:\n\n' f'der Gast {guest.name} ({guest.mail}) hat folgende Nachricht gesendet:\n\n'
f'{message.message}' f'{message.message}'
# TODO: HTML message
# TODO: add attachments # TODO: add attachments
# TODO: add link to message # TODO: add link to message
@ -50,17 +51,20 @@ def process_message(message: MailMessage, guest: Guest):
question.save() question.save()
# TODO: save attachments and add to message # TODO: save attachments and add to message
logger.info( logger.info(
f'Valid answer for Question {question_pk} from {message.from_} received.') 'Valid answer for Question %s from %s received.'
% (question_pk, message.from_))
# TODO: send notifications # TODO: send notifications
else: else:
logger.warning( logger.warning(
f'Answer for Question {question_pk} from {message.from_} received,' 'Answer for Question %s from %s received,'
' but the question was not for this guest. Message was ignored.') ' but the question was not for this guest. Message was ignored.'
% (question_pk, message.from_))
# TODO: send reply that mail address was wrong # TODO: send reply that mail address was wrong
else: else:
logger.warning( logger.warning(
f'Answer for Question {question_pk} from {message.from_} received,' 'Answer for Question %s from %s received,'
' but there is no such question. Message was ignored.') ' but there is no such question. Message was ignored.'
% (question_pk, message.from_))
else: else:
db_message = Message( db_message = Message(
message=content, message=content,