Skip to content

Commit

Permalink
Merge pull request #105 from demisto/Parse-strinct-email-address
Browse files Browse the repository at this point in the history
Parse strict email address
  • Loading branch information
MosheEichler authored Dec 8, 2024
2 parents 89fbaf5 + 26d6791 commit 7556504
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

v0.1.32
* Fixed an issue that prevented malformed email addresses from being parsed.

v0.1.31
* Fixed an issue that prevented the headers from being parsed correctly for MSG files (ASCII encoding).

Expand Down
5 changes: 4 additions & 1 deletion parse_emails/handle_eml.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ def get_email_address(eml, entry):
for current_eml_no_newline in eml.get_all(entry, [])]
else:
gel_all_values_from_email_by_entry = eml.get_all(entry, [])
addresses = getaddresses(gel_all_values_from_email_by_entry)
try:
addresses = getaddresses(gel_all_values_from_email_by_entry, strict=False)
except TypeError:
addresses = getaddresses(gel_all_values_from_email_by_entry)
if addresses:
res = [email_address for real_name, email_address in addresses if "@" in email_address]
res = ', '.join(res)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "parse-emails"
version = "0.1.31"
version = "0.1.32"
description = "Parses an email message file and extracts the data from it."
authors = ["Demisto"]
license = "MIT"
Expand Down

0 comments on commit 7556504

Please sign in to comment.