mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
handle case alias was deleted in the meantime
This commit is contained in:
parent
01a8a0343e
commit
b24d58bdf3
|
@ -51,6 +51,7 @@ from email_validator import validate_email, EmailNotValidError
|
|||
from flanker.addresslib import address
|
||||
from flanker.addresslib.address import EmailAddress
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm.exc import ObjectDeletedError
|
||||
|
||||
from app import pgp_utils, s3
|
||||
from app.alias_utils import try_auto_create
|
||||
|
@ -547,7 +548,17 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str
|
|||
|
||||
from_header = get_header_unicode(msg[headers.FROM])
|
||||
LOG.d("Create or get contact for from_header:%s", from_header)
|
||||
try:
|
||||
contact = get_or_create_contact(from_header, envelope.mail_from, alias)
|
||||
except ObjectDeletedError:
|
||||
LOG.d("maybe alias was deleted in the meantime")
|
||||
alias = Alias.get_by(email=alias_address)
|
||||
if not alias:
|
||||
LOG.i("Alias %s was deleted in the meantime", alias_address)
|
||||
if should_ignore_bounce(envelope.mail_from):
|
||||
return [(True, status.E207)]
|
||||
else:
|
||||
return [(False, status.E515)]
|
||||
|
||||
reply_to_contact = None
|
||||
if msg[headers.REPLY_TO]:
|
||||
|
|
Loading…
Reference in a new issue