fix handle_hotmail_complaint: handle email format with name

This commit is contained in:
Son Nguyen Kim 2021-09-08 11:02:35 +02:00
parent 41f10373d1
commit 201eb3b9b9

View file

@ -1287,11 +1287,13 @@ def handle_hotmail_complaint(msg: Message):
Handle hotmail complaint sent to postmaster Handle hotmail complaint sent to postmaster
""" """
orig_msg = get_orig_message_from_outlook_complaint(msg) orig_msg = get_orig_message_from_outlook_complaint(msg)
alias_address = orig_msg["To"] to_header = orig_msg["To"]
_, alias_address = parseaddr_unicode(to_header)
alias = Alias.get_by(email=alias_address) alias = Alias.get_by(email=alias_address)
if not alias: if not alias:
LOG.d("No alias for %s", alias_address) LOG.d("No alias for %s", alias_address)
return
user = alias.user user = alias.user
LOG.e("Handle hotmail complaint for %s %s", alias, user) LOG.e("Handle hotmail complaint for %s %s", alias, user)