log headers in case a contact email is skipped

This commit is contained in:
Son NK 2020-11-26 09:49:03 +01:00
parent dcd116f11a
commit e2f0a72ab7
1 changed files with 3 additions and 6 deletions

View File

@ -258,8 +258,8 @@ def replace_header_when_forward(msg: Message, alias: Alias, header: str):
Replace CC or To header by Reply emails in forward phase Replace CC or To header by Reply emails in forward phase
""" """
new_addrs: [str] = [] new_addrs: [str] = []
headers = msg.get_all(header, [])
for contact_name, contact_email in getaddresses(msg.get_all(header, [])): for contact_name, contact_email in getaddresses(headers):
# convert back to original then parse again to make sure contact_name is unicode # convert back to original then parse again to make sure contact_name is unicode
addr = formataddr((contact_name, contact_email)) addr = formataddr((contact_name, contact_email))
contact_name, contact = parseaddr_unicode(addr) contact_name, contact = parseaddr_unicode(addr)
@ -270,10 +270,7 @@ def replace_header_when_forward(msg: Message, alias: Alias, header: str):
continue continue
if not is_valid_email(contact_email): if not is_valid_email(contact_email):
LOG.exception( LOG.exception("invalid contact email %s. %s. Skip", contact_email, headers)
"invalid contact email %s. Skip",
contact_email,
)
continue continue
contact = Contact.get_by(alias_id=alias.id, website_email=contact_email) contact = Contact.get_by(alias_id=alias.id, website_email=contact_email)