skip invalid contact in replace_header_when_forward()

This commit is contained in:
Son NK 2020-11-25 15:21:01 +01:00
parent dfcb74dc87
commit ac1a6f5613
1 changed files with 7 additions and 0 deletions

View File

@ -269,6 +269,13 @@ def replace_header_when_forward(msg: Message, alias: Alias, header: str):
new_addrs.append(addr)
continue
if not is_valid_email(contact_email):
LOG.exception(
"invalid contact email %s. Skip",
contact_email,
)
continue
contact = Contact.get_by(alias_id=alias.id, website_email=contact_email)
if contact:
# update the contact name if needed