Split an email address into its local and domain parts
This was built to grab the name used off of an email address. This library does not perform validation as we retrieve our email addresses from a trusted source.
This was initially written in JavaScript and has been ported to Python.
Install the module with: pip install email_split
from email_split import email_split
email = email_split('[email protected]')
email.local # todd
email.domain # underdog.io
We export the function email_split
from our module email_split
.
Function that extracts local and domain parts of email address.
- email
str
- Email address to break down
Returns:
- email
object
- Object representing email address- local
str
- Leading portion of email address- For example,
todd
in[email protected]
- For example,
- domain
str
- Tailing portion of email address- For example,
underdog.io
in[email protected]
- For example,
- local
We chose the names local and domain based off of the RFC specification for mailto.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test and lint via ./test.sh
.
Copyright (c) 2016 Underdog.io
Licensed under the MIT license.