Return a normalized email-address stripping ISP specific behaviors
Project description
email-normalize
A Python 3.11+ library for normalizing email addresses by stripping
mailbox-provider-specific behaviors such as plus addressing
(foo+bar@gmail.com) and period ignoring (f.o.o@gmail.com).
Installation
pip install email-normalize
Usage
Synchronous
import email_normalize
result = email_normalize.normalize('f.o.o+bar@gmail.com')
print(result.normalized_address) # foo@gmail.com
print(result.mailbox_provider) # Google
print(result.mx_records) # [(5, 'gmail-smtp-in.l.google.com'), ...]
Async
For use within an asyncio application, use the Normalizer class directly:
import asyncio
import email_normalize
async def main():
normalizer = email_normalize.Normalizer()
result = await normalizer.normalize('f.o.o+bar@gmail.com')
print(result.normalized_address)
asyncio.run(main())
The Normalizer maintains a LFRU cache of MX lookups, making it efficient
for batch processing.
Without DNS Lookups
Use skip_dns=True to normalize against well-known domains without
performing MX record lookups:
result = email_normalize.normalize('user+tag@gmail.com', skip_dns=True)
This mode uses a static domain map and will not detect providers for custom domains.
Normalization Rules
| Provider | Plus Addressing | Strip Periods | Local Part as Hostname |
|---|---|---|---|
| Apple | x | ||
| Fastmail | x | x | |
| x | x* | ||
| Microsoft | x | ||
| ProtonMail | x | ||
| Rackspace | x | ||
| Yahoo | |||
| Yandex | x | ||
| Zoho | x |
- Plus Addressing: Strips everything after
+in the local part - Strip Periods: Removes
.from the local part - Local Part as Hostname: Extracts the subdomain as the local part (Fastmail custom domains)
* Google strips periods only for consumer Gmail addresses (gmail.com and
googlemail.com). Google Workspace custom domains route through the same MX
servers but treat periods as significant, so periods are preserved for them
(plus addressing is still stripped).
Documentation
Full documentation is available at gmr.github.io/email-normalize.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file email_normalize-3.1.0.tar.gz.
File metadata
- Download URL: email_normalize-3.1.0.tar.gz
- Upload date:
- Size: 68.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d226bed0eddb1aba2b02bd007292e95c6ca554751402c7a8821fcbb0005e4e40
|
|
| MD5 |
c65483bfc33d7b31ee7e2e69f22117f0
|
|
| BLAKE2b-256 |
0220cf96d09bfd1b5c247e4179da7412e2bcc04a1f288c6efbd5f913262de4f6
|
Provenance
The following attestation bundles were made for email_normalize-3.1.0.tar.gz:
Publisher:
deploy.yaml on gmr/email-normalize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
email_normalize-3.1.0.tar.gz -
Subject digest:
d226bed0eddb1aba2b02bd007292e95c6ca554751402c7a8821fcbb0005e4e40 - Sigstore transparency entry: 1805179730
- Sigstore integration time:
-
Permalink:
gmr/email-normalize@b36e592c747bcb8e31ddbd1230882fd98ee7be32 -
Branch / Tag:
refs/tags/3.1.0 - Owner: https://github.com/gmr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@b36e592c747bcb8e31ddbd1230882fd98ee7be32 -
Trigger Event:
release
-
Statement type:
File details
Details for the file email_normalize-3.1.0-py3-none-any.whl.
File metadata
- Download URL: email_normalize-3.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a1bf330e021ab1b119603f057b0791ca473d56a6cdf2bab0968414b4e228d12
|
|
| MD5 |
50a76ecca8da0bd4a4d97ba592f2c719
|
|
| BLAKE2b-256 |
8c4540140e74dce9c513e7192c611bf25e492251ceed3b411e4a1eb244e330b7
|
Provenance
The following attestation bundles were made for email_normalize-3.1.0-py3-none-any.whl:
Publisher:
deploy.yaml on gmr/email-normalize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
email_normalize-3.1.0-py3-none-any.whl -
Subject digest:
6a1bf330e021ab1b119603f057b0791ca473d56a6cdf2bab0968414b4e228d12 - Sigstore transparency entry: 1805179765
- Sigstore integration time:
-
Permalink:
gmr/email-normalize@b36e592c747bcb8e31ddbd1230882fd98ee7be32 -
Branch / Tag:
refs/tags/3.1.0 - Owner: https://github.com/gmr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@b36e592c747bcb8e31ddbd1230882fd98ee7be32 -
Trigger Event:
release
-
Statement type: