do not use email_validator in get_email_domain_part()
This commit is contained in:
parent
3ad961bfb9
commit
8301015afd
|
@ -128,7 +128,6 @@ def try_auto_create_via_domain(address: str) -> Optional[Alias]:
|
||||||
# check if alias is custom-domain alias and if the custom-domain has catch-all enabled
|
# check if alias is custom-domain alias and if the custom-domain has catch-all enabled
|
||||||
alias_domain = get_email_domain_part(address)
|
alias_domain = get_email_domain_part(address)
|
||||||
custom_domain: CustomDomain = CustomDomain.get_by(domain=alias_domain)
|
custom_domain: CustomDomain = CustomDomain.get_by(domain=alias_domain)
|
||||||
alias_note = ""
|
|
||||||
|
|
||||||
if not custom_domain:
|
if not custom_domain:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -404,10 +404,8 @@ def get_email_domain_part(address):
|
||||||
Get the domain part from email
|
Get the domain part from email
|
||||||
ab@cd.com -> cd.com
|
ab@cd.com -> cd.com
|
||||||
"""
|
"""
|
||||||
r: ValidatedEmail = validate_email(
|
address = sanitize_email(address)
|
||||||
address, check_deliverability=False, allow_smtputf8=False
|
return address[address.find("@") + 1 :]
|
||||||
)
|
|
||||||
return r.domain
|
|
||||||
|
|
||||||
|
|
||||||
# headers used to DKIM sign in order of preference
|
# headers used to DKIM sign in order of preference
|
||||||
|
@ -532,7 +530,9 @@ def email_can_be_used_as_mailbox(email_address: str) -> bool:
|
||||||
- a disposable domain
|
- a disposable domain
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
domain = get_email_domain_part(email_address)
|
domain = validate_email(
|
||||||
|
email_address, check_deliverability=False, allow_smtputf8=False
|
||||||
|
).domain
|
||||||
except EmailNotValidError:
|
except EmailNotValidError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue