make sure alias that starts with bounce prefix can't be automatically created
This commit is contained in:
parent
de23828df1
commit
6cb55e27f3
|
@ -4,7 +4,7 @@ from typing import Optional
|
||||||
from email_validator import validate_email, EmailNotValidError
|
from email_validator import validate_email, EmailNotValidError
|
||||||
from sqlalchemy.exc import IntegrityError, DataError
|
from sqlalchemy.exc import IntegrityError, DataError
|
||||||
|
|
||||||
from app.config import BOUNCE_PREFIX_FOR_REPLY_PHASE
|
from app.config import BOUNCE_PREFIX_FOR_REPLY_PHASE, BOUNCE_PREFIX
|
||||||
from app.db import Session
|
from app.db import Session
|
||||||
from app.email_utils import (
|
from app.email_utils import (
|
||||||
get_email_domain_part,
|
get_email_domain_part,
|
||||||
|
@ -37,6 +37,10 @@ def try_auto_create(address: str) -> Optional[Alias]:
|
||||||
LOG.e("alias %s can't start with %s", address, BOUNCE_PREFIX_FOR_REPLY_PHASE)
|
LOG.e("alias %s can't start with %s", address, BOUNCE_PREFIX_FOR_REPLY_PHASE)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if address.startswith(BOUNCE_PREFIX):
|
||||||
|
LOG.e("alias %s can't start with %s", address, BOUNCE_PREFIX)
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# NOT allow unicode for now
|
# NOT allow unicode for now
|
||||||
validate_email(address, check_deliverability=False, allow_smtputf8=False)
|
validate_email(address, check_deliverability=False, allow_smtputf8=False)
|
||||||
|
|
Loading…
Reference in a new issue