Skip to content

Commit

Permalink
Handle unexpected recipient value. Add logging. (#4626)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasb authored Jul 8, 2024
1 parent 22556f4 commit 6fec1eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion engine/apps/email/inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ def get_integration_token_from_request(self, request) -> Optional[str]:
# First try envelope_recipient field.
# According to AnymailInboundMessage it's provided not by all ESPs.
if message.envelope_recipient:
token, domain = message.envelope_recipient.split("@")
try:
token, domain = message.envelope_recipient.split("@")
except ValueError:
logger.error(
f"get_integration_token_from_request: envelope_recipient field has unexpected format: {message.envelope_recipient}"
)
return None
if domain == live_settings.INBOUND_EMAIL_DOMAIN:
return token
else:
Expand Down

0 comments on commit 6fec1eb

Please sign in to comment.