Skip to content

Commit 7556504

Browse files
authored
Merge pull request #105 from demisto/Parse-strinct-email-address
Parse strict email address
2 parents 89fbaf5 + 26d6791 commit 7556504

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
v0.1.32
4+
* Fixed an issue that prevented malformed email addresses from being parsed.
5+
36
v0.1.31
47
* Fixed an issue that prevented the headers from being parsed correctly for MSG files (ASCII encoding).
58

parse_emails/handle_eml.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,10 @@ def get_email_address(eml, entry):
430430
for current_eml_no_newline in eml.get_all(entry, [])]
431431
else:
432432
gel_all_values_from_email_by_entry = eml.get_all(entry, [])
433-
addresses = getaddresses(gel_all_values_from_email_by_entry)
433+
try:
434+
addresses = getaddresses(gel_all_values_from_email_by_entry, strict=False)
435+
except TypeError:
436+
addresses = getaddresses(gel_all_values_from_email_by_entry)
434437
if addresses:
435438
res = [email_address for real_name, email_address in addresses if "@" in email_address]
436439
res = ', '.join(res)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "parse-emails"
3-
version = "0.1.31"
3+
version = "0.1.32"
44
description = "Parses an email message file and extracts the data from it."
55
authors = ["Demisto"]
66
license = "MIT"

0 commit comments

Comments
 (0)