Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Testing
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'setup.*'
- '*.md'
- '*.rst'
push:
branches: ["*"]
paths-ignore:
Expand Down
2 changes: 0 additions & 2 deletions email_normalize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ async def normalize(self, email_address: str) -> Result:
local_part = local_part.replace('.', '')
if provider.Flags & providers.Rules.PLUS_ADDRESSING:
local_part = local_part.split('+')[0]
if provider.Flags & providers.Rules.DASH_ADDRESSING:
local_part = local_part.split('-')[0]
return Result(email_address, '@'.join([local_part, domain_part]),
mx_records, provider.__name__ if provider else None)

Expand Down
7 changes: 5 additions & 2 deletions email_normalize/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Rules(enum.Flag):
Used to determine how to normalize provider specific email addresses.

"""
DASH_ADDRESSING = enum.auto()
NONE = 0
PLUS_ADDRESSING = enum.auto()
LOCAL_PART_AS_HOSTNAME = enum.auto()
STRIP_PERIODS = enum.auto()
Expand Down Expand Up @@ -55,7 +55,10 @@ class Rackspace(MailboxProvider):


class Yahoo(MailboxProvider):
Flags: Rules = Rules.DASH_ADDRESSING
# No normalization rules — Yahoo disposable addresses use the format
# nickname-keyword@, where the nickname alone is not a deliverable
# address. See https://help.yahoo.com/kb/SLN28815.html
Flags: Rules = Rules.NONE
MXDomains: typing.Set[str] = {'yahoodns.net'}


Expand Down
2 changes: 1 addition & 1 deletion tests/test_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_yahoo(self):
address = '{}@{}'.format(local_part, domain_part)
mx_records = [(1, 'mta5.am0.yahoodns.net')]
self._perform_test(
address, '{}@{}'.format(local_part.split('-', 1)[0], domain_part),
address, '{}@{}'.format(local_part, domain_part),
mx_records, 'Yahoo')

def test_yandex(self):
Expand Down