Skip to content

Commit

Permalink
Classify UnresponsiveMailServer is invalid destination
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Jan 6, 2023
1 parent fb0ab7a commit 094c4f4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
11 changes: 2 additions & 9 deletions gmailconnector/validator/validate_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,13 @@ def validate_email(email_address: str, timeout: Union[int, float] = 5, sender: s
if not smtp_check:
try:
list(get_mx_records(domain=address.domain))
except (InvalidDomain, NotMailServer) as error:
except (InvalidDomain, NotMailServer, UnresponsiveMailServer) as error:
logger.error(error)
return Response(dictionary={
'ok': False,
'status': 422,
'body': error.__str__()
})
except UnresponsiveMailServer as error:
logger.error(error)
return Response(dictionary={
'ok': None,
'status': 207,
'body': error.__str__()
})
return Response(dictionary={
'ok': True,
'status': 200,
Expand Down Expand Up @@ -112,7 +105,7 @@ def validate_email(email_address: str, timeout: Union[int, float] = 5, sender: s
'status': 207,
'body': 'Received multiple temporary errors. Could not finish validation.'
})
except (InvalidDomain, NotMailServer) as error:
except (InvalidDomain, NotMailServer, UnresponsiveMailServer) as error:
logger.error(error)
return Response(dictionary={
'ok': False,
Expand Down
4 changes: 4 additions & 0 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release Notes
=============

0.6.2 (01/05/2023)
------------------
- Classify `UnresponsiveMailServer` is invalid destination

0.6.1 (01/05/2023)
------------------
- Catch edge case scenario in validation emails
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version_info = (0, 6, 1)
version_info = (0, 6, 2)

0 comments on commit 094c4f4

Please sign in to comment.