Meta tags:
description= A robust email syntax and deliverability validation library for Python. - JoshData/python-email-validator;
Headings (most frequently used words):
navigation, email, addresses, internationalized, normalization, repository, about, and, files, footer, topics, resources, contributing, stars, watchers, forks, unicode, validator, validate, menu, latest, commit, history, folders, installation, quick, start, usage, examples, return, value, assumptions, testing, for, project, maintainers, license, releases, used, by, contributors, languages, overview, options, dns, timeout, cache, test, domain, names, idn, local, parts, unsafe, characters, are, rejected, other,
Text of the page (most frequently used words):
the (203), email (86), and (75), address (67), #domain (51), you (48), for (41), this (39), are (37), that (30), part (28), normalized (26), not (25), #addresses (25), your (24), form (24), dns (23), local (23), characters (23), use (22), name (22), set (22), true (21), can (20), library (20), with (19), test (19), false (19), ascii (18), see (17), internationalized (17), github (16), normalization (16), email_validator (16), all (16), mail (16), unicode (16), names (15), will (15), smtputf8 (15), when (14), object (14), example (14), validation (13), validate_email (13), deliverability (12), joshdata (12), string (12), but (12), checks (12), returned (12), which (12), also (12), syntax (11), default (11), idna (11), resolver (11), validator (10), turn (10), record (10), like (10), display (10), valid (10), python (9), tests (9), database (9), only (9), none (9), field (9), ascii_email (9), other (9), contributing (8), com (8), changelog (8), using (8), these (8), because (8), has (8), before (8), sign (8), should (8), they (8), support (8), security (7), below (7), from (7), quoted (7), parts (7), allow (7), them (7), above (7), would (7), check (7), rfc (7), non (7), login (7), calls (7), used (6), repository (6), readme (6), obsolete (6), rejected (6), there (6), forms (6), must (6), may (6), timeout (6), present (6), ascii_domain (6), quotes (6), local_part (6), life (6), ipv6 (6), after (6), user (6), function (6), code (6), about (5), license (5), version (5), make (5), one (5), their (5), test_environment (5), special (5), instead (5), allow_smtputf8 (5), allowed (5), punycode (5), message (5), first (5), ascii_local_part (5), unnecessary (5), based (5), might (5), emailinfo (5), submission (5), domains (5), want (5), check_deliverability (5), information (4), navigation (4), forks (4), 151 (4), stars (4), unlicense (4), robust (4), any (4), prior (4), commit (4), pass (4), package (4), build (4), why (4), does (4), spf (4), value (4), have (4), contains (4), ipaddress (4), allow_quoted_local (4), fields (4), validatedemail (4), some (4), invalid (4), account (4), creation (4), org (4), require (4), internationalization (4), its (4), probably (4), caching_resolver (4), validating (4), more (4), pages (4), emailnotvaliderror (4), features (4), setup (4), signed (4), copilot (4), time (3), resources (3), project (3), was (3), public (3), release_to_pypi (3), source (3), release (3), creating (3), new (3), https (3), number (3), queries (3), test_requirements (3), txt (3), options (3), accept (3), without (3), error (3), except (3), many (3), cause (3), records (3), aaaa (3), type (3), temporary (3), section (3), required (3), always (3), exception (3), given (3), surrounding (3), including (3), returns (3), same (3), bdk (3), even (3), allow_domain_literal (3), 2008 (3), into (3), different (3), equivalent (3), what (3), print (3), control (3), emailsyntaxerror (3), english (3), system (3), good (3), gives (3), documentation (3), consider (3), special_use_domain_names (3), import (3), add (3), localhost (3), cache (3), off (3), receive (3), optionally (3), deliverable (3), latest (3), opinionated (3), files (3), actions (3), quality (3), another (3), tab (3), window (3), refresh (3), session (3), reload (3), developers (3), customer (3), enterprise (3), grade (3), perform (2), contact (2), community (2), status (2), privacy (2), terms (2), footer (2), releases (2), report (2), watching (2), watchers (2), activity (2), topics (2), made (2), universal (2), git (2), tag (2), push (2), tags (2), sed (2), wheel (2), pypi (2), command (2), update (2), run (2), mocked (2), responses (2), flag (2), pip (2), install (2), syntaxes (2), literal (2), uses (2), anymore (2), need (2), described (2), well (2), found (2), while (2), checking (2), actually (2), specified (2), could (2), completed (2), issue (2), list (2), indicating (2), feature (2), relay (2), transmit (2), messages (2), cannot (2), encoded (2), argument (2), been (2), angle (2), brackets (2), empty (2), unquoted (2), unescaped (2), display_name (2), literals (2), ipv6address (2), ipv4address (2), domain_address (2), either (2), converted (2), nfc (2), combines (2), put (2), return (2), possible (2), cases (2), fictitious (2), backslash (2), escaping (2), removed (2), condensed (2), change (2), length (2), both (2), case (2), fullwidth (2), combining (2), end (2), replace (2), immediately (2), going (2), during (2), querying (2), outbound (2), letters (2), counterparts (2), normalizes (2), problem (2), look (2), provides (2), safe (2), especially (2), text (2), protect (2), reserved (2), whitespace (2), work (2), than (2), unsafe (2), servers (2), own (2), server (2), extension (2), ahead (2), then (2), out (2), keyword (2), sort (2), module (2), though (2), doesn (2), ized (2), smtp (2), each (2), separate (2), reject (2), disabled (2), resolve (2), myname (2), remove (2), call (2), rejects (2), able (2), still (2), environments (2), dns_resolver (2), caching (2), reuse (2), bracketed (2), allow_display_name (2), applicable (2), removes (2), permitted (2), instance (2), shown (2), across (2), skip (2), since (2), sometimes (2), whether (2), failure (2), raises (2), fails (2), human (2), readable (2), validates (2), query (2), view (2), history (2), users (2), registration (2), items (2), cfg (2), pyproject (2), toml (2), makefile (2), manifest (2), gitignore (2), workflows (2), last (2), 270 (2), commits (2), menu (2), star (2), settings (2), insights (2), projects (2), universe (2), training (2), integrations (2), stories (2), center (2), learn (2), business (2), fixes (2), products (2), secret (2), action, share, personal, manage, cookies, docs, 2026, inc, languages, contributors, free, copyright, restrictions, per, feb, 2024, available, under, cc0, dedication, cat, publish, distribution, sure, distributed, maintainers, adding, changing, temporarily, live, mocked_dns_responses, build_mocked_dns_response_data, testing, unusual, extremely, old, think, reason, anyone, comment, assumes, intended, usable, internet, resolvable, most, subdomains, parameter, design, strictly, conform, standards, likely, trouble, assumptions, queried, inferred, through, mechanism, mx_fallback_type, priority, tuples, 5321, boolean, passed, raised, surround, otherwise, were, transmitted, wire, canonical, else, composed, includes, removing, backslashes, necessary, replacing, exists, already, merely, passes, now, edge, original, calling, exact, contain, note, provide, earlier, discussion, ⓛⓘⓕⓔ, examples, applied, requires, lowercase, specific, mailbox, postmaster, 2142, 5895, 6532, such, vice, versa, permits, normalizations, include, lowercasing, insensitive, whole, turns, plus, precomposed, where, replacement, possibly, mappings, conversion, uts46, halfwidth, times, ought, enter, sending, prints, twice, domain, cjk, latin, considered, semantically, introduced, strings, identical, semantic, meaning, successful, correctly, surprisingly, large, concatenated, tries, permitting, private, formatting, alter, order, character, combine, something, outside, relevant, applying, nearly, inputs, sensitive, context, guard, against, known, alike, fool, humans, reading, displayed, trojansource, codes, qntm, along, route, destination, varies, know, supported, stack, filter, raise, delivery, 6531, second, numbers, punctuation, wider, range, updated, starting, replaced, process, transmission, transparently, conforms, kim, davies, compliance, around, web, very, 5891, idn, back, protocol, historically, respectively, adapted, way, two, aspects, tempting, shouldn, iana, risk, accidentally, emailing, someone, those, beware, nevertheless, net, globally, others, raising, abuse, don, sent, although, via, malicious, however, production, three, ways, seconds, create, easily, additional, currently, service, providers, ensure, meet, broad, compatibility, requirements, strict, postfix, aliases, allow_empty_local, input, implemented, spirit, letter, 5322, stricter, relaxed, provided, being, ipv4, prefixed, performed, format, attribute, hold, parsed, obscure, potentially, problematic, spaces, signs, surprising, surrounded, called, prohibit, setting, helper, construct, lrucache, recommended, performing, previously, validated, every, undesirable, accepts, following, arguments, defaults, null, fallback, unless, slow, unavailable, unreliable, useful, aren, nothing, gained, trying, done, here, practicality, reasons, giving, away, appear, bounce, delay, bounced, indicate, intentional, greylisting, permit, obsoleted, give, grief, later, document, how, containing, classes, subclasses, subclass, valueerror, emailundeliverableerror, helpful, explaining, takes, email_address, overview, usage, normalize, avoid, str, explanation, point, validations, try, application, quick, start, depending, environment, pip3, installation, changes, occasionally, published, details, notes, definitely, less, works, better, pyisemail, annotations, important, find, unexpected, dot, supports, parses, optional, override, friendly, correct, great, data, key, identifying, joshua, tauberer, validate, date, folders, open, file, branches, main, fork, notification, notifications, wiki, pull, requests, issues, dismiss, alert, switched, accounts, appearance, search, pricing, event, talks, workshops, next, partners, company, forum, events, webinars, blog, resource, connect, premium, advanced, ons, trust, evaluate, industries, government, manufacturing, financial, services, healthcare, industry, nonprofits, startups, team, enterprises, stage, businesses, improvements, place, developer, articles, sponsors, trending, repos, explore, customize, certifications, scanning, leak, prevention, protection, vulnerability, detection, remediation, secure, cloud, development, codespaces, analysis, enforcement, automation, ship, coding, agent, tasks, automated, hosting, review, collaboration, platform, content,
Text of the page (random words):
ble since they will probably give you grief if you re using email for login see later in the document about how to allow some obsolete forms the validator optionally checks that the domain name in the email address has a dns mx record indicating that it can receive email except a null mx record if there is no mx record a fallback a aaaa record is permitted unless a reject all spf record is present dns is slow and sometimes unavailable or unreliable so consider whether these checks are useful for your use case and turn them off if they aren t there is nothing to be gained by trying to actually contact an smtp server so that s not done here for privacy security and practicality reasons servers are good at not giving away whether an address is deliverable or not email addresses that appear to accept mail at first can bounce mail after a delay and bounced mail may indicate a temporary failure of a good email address sometimes an intentional failure like greylisting options the validate_email function also accepts the following keyword arguments defaults are as shown below check_deliverability true if true dns queries are made to check that the domain name in the email address the part after the sign can receive mail as described above set to false to skip this dns based check it is recommended to pass false when performing validation for login pages but not account creation pages since re validation of a previously validated domain in your database by querying dns at every login is probably undesirable you can also set email_validator check_deliverability to false to turn this off for all calls by default dns_resolver none pass an instance of dns resolver resolver to control the dns resolver including setting a timeout and a cache the caching_resolver function shown below is a helper function to construct a dns resolver resolver with a lrucache reuse the same resolver instance across calls to validate_email to make use of the cache test_environment false if true dns based deliverability checks are disabled and test and test domain names are permitted see below you can also set email_validator test_environment to true to turn it on for all calls by default allow_smtputf8 true set to false to prohibit internationalized addresses that would require the smtputf8 extension you can also set email_validator allow_smtputf8 to false to turn it off for all calls by default allow_quoted_local false set to true to allow obscure and potentially problematic email addresses in which the part of the address before the sign contains spaces signs or other surprising characters when the local part is surrounded in quotes so called quoted string local parts in the object returned by validate_email the normalized local part removes any unnecessary backslash escaping and even removes the surrounding quotes if the address would be valid without them you can also set email_validator allow_quoted_local to true to turn this on for all calls by default allow_domain_literal false set to true to allow bracketed ipv4 and ipv6 prefixed ipv6 addresses in the domain part of the email address no deliverability checks are performed for these addresses in the object returned by validate_email the normalized domain will use the condensed ipv6 format if applicable the object s domain_address attribute will hold the parsed ipaddress ipv4address or ipaddress ipv6address object if applicable you can also set email_validator allow_domain_literal to true to turn this on for all calls by default allow_display_name false set to true to allow a display name and bracketed address in the input string like my name me example org it s implemented in the spirit but not the letter of rfc 5322 3 4 so it may be stricter or more relaxed than what you want the display name if present is provided in the returned object s display_name field after being unquoted and unescaped you can also set email_validator allow_display_name to true to turn this on for all calls by default allow_empty_local false set to true to allow an empty local part i e example com e g for validating postfix aliases strict false set to true to perform additional syntax checks currently only a local part length check this should be used by mail service providers at address creation to ensure email addresses meet broad compatibility requirements dns timeout and cache when validating many email addresses or to control the timeout the default is 15 seconds create a caching dns resolver resolver to reuse in each call the caching_resolver function returns one easily for you from email_validator import validate_email caching_resolver resolver caching_resolver timeout 10 while true validate_email email dns_resolver resolver test addresses this library rejects email addresses that use the special use domain names invalid localhost test and some others by raising emailsyntaxerror this is to protect your system from abuse you probably don t want a user to be able to cause an email to be sent to localhost although they might be able to still do so via a malicious mx record however in your non production test environments you may want to use test or myname test email addresses there are three ways you can allow this add test_environment true to the call to validate_email see above set email_validator test_environment to true globally remove the special use domain name that you want to use from email_validator special_use_domain_names e g import email_validator email_validator special_use_domain_names remove test it is tempting to use example com net org in tests they are not in this library s special_use_domain_names list so you can but shouldn t use them these domains are reserved to iana for use in documentation so there is no risk of accidentally emailing someone at those domains but beware that this library will nevertheless reject these domain names if dns based deliverability checks are not disabled because these domains do not resolve to domains that accept email in tests consider using your own domain name or test or myname test instead internationalized email addresses the email protocol smtp and the domain name system dns have historically only allowed english ascii characters in email addresses and domain names respectively each has adapted to internationalization in a separate way creating two separate aspects to email address internationalization if your mail submission library doesn t support unicode at all then immediately prior to mail submission you must replace the email address with its ascii ized form this library gives you back the ascii ized form in the ascii_email field in the returned object internationalized domain names idn the first is internationalized domain names rfc 5891 a k a idna 2008 the dns system has not been updated with unicode support instead internationalized domain names are converted into a special idna ascii punycode form starting with xn when an email address has non ascii characters in its domain part the domain part is replaced with its idna ascii equivalent form in the process of mail transmission your mail submission library probably does this for you transparently compliance around the web is not very good though this library conforms to idna 2008 using the idna module by kim davies internationalized local parts the second sort of internationalization is internationalization in the local part of the address before the sign in non internationalized email addresses only english letters numbers and some punctuation _ are allowed in internationalized email address local parts a wider range of unicode characters are allowed email addresses with these non ascii characters require that your mail submission library and all the mail servers along the route to the destination including your own outbound mail server all support the smtputf8 rfc 6531 extension support for smtputf8 varies if you know ahead of time that smtputf8 is not supported by your mail submission stack then you must filter out addresses that require smtputf8 using the allow_smtputf8 false keyword argument see above this will cause the validation function to raise a emailsyntaxerror if delivery would require smtputf8 if you do not set allow_smtputf8 false you can also check the value of the smtputf8 field in the returned object unsafe unicode characters are rejected a surprisingly large number of unicode characters are not safe to display especially when the email address is concatenated with other text so this library tries to protect you by not permitting reserved non private use formatting which can be used to alter the display order of characters whitespace and control characters and combining characters as the first character of the local part and the domain name so that they cannot combine with something outside of the email address string or with the sign see https qntm org safe and https trojansource codes for relevant prior work other than whitespace these are checks that you should be applying to nearly all user inputs in a security sensitive context this does not guard against the well known problem that many unicode characters look alike which can be used to fool humans reading displayed text normalization unicode normalization the use of unicode in email addresses introduced a normalization problem different unicode strings can look identical and have the same semantic meaning to the user the normalized field returned on successful validation provides the correctly normalized form of the given email address for example the cjk fullwidth latin letters are considered semantically equivalent in domain names to their ascii counterparts this library normalizes them to their ascii counterparts as required by idna emailinfo validate_email me domain com print emailinfo normalized print emailinfo ascii_email prints me domain com twice because an end user might type their email address in different but equivalent un normalized forms at different times you ought to replace what they enter with the normalized form immediately prior to going into your database during account creation querying your database during login or sending outbound mail the normalizations include lowercasing the domain part of the email address domain names are case insensitive unicode nfc normalization of the whole address which turns characters plus combining characters into precomposed characters where possible replacement of fullwidth and halfwidth characters in the domain part possibly other uts46 mappings on the domain part and conversion from punycode to unicode characters normalization may change the characters in the email address and the length of the email address such that a string might be a valid address before normalization but invalid after or vice versa this library only permits addresses that are valid both before and after normalization see rfc 6532 internationalized email section 3 1 and rfc 5895 idna 2008 section 2 other normalization normalization is also applied to quoted string local parts and domain literal ipv6 addresses if you have allowed them by the allow_quoted_local and allow_domain_literal options in quoted string local parts unnecessary backslash escaping is removed and even the surrounding quotes are removed if they are unnecessary for ipv6 domain literals the ipv6 address is normalized to condensed form rfc 2142 also requires lowercase normalization for some specific mailbox names like postmaster examples for the email address test joshdata me the returned object is validatedemail normalized test joshdata me local_part test domain joshdata me ascii_email test joshdata me ascii_local_part test ascii_domain joshdata me smtputf8 false for the fictitious but valid address example ツ ⓛⓘⓕⓔ which has an internationalized domain but ascii local part the returned object is validatedemail normalized example ツ life local_part example domain ツ life ascii_email example xn bdk life ascii_local_part example ascii_domain xn bdk life smtputf8 false note that normalized and other fields provide a normalized form of the email address domain name and in other cases local part see earlier discussion of normalization which you should use in your database calling validate_email with the ascii form of the above email address example xn bdk life returns the exact same information i e the normalized field always will contain unicode characters not punycode for the fictitious address ツ test joshdata me which has an internationalized local part the returned object is validatedemail normalized ツ test joshdata me local_part ツ test domain joshdata me ascii_email none ascii_local_part none ascii_domain joshdata me smtputf8 true now smtputf8 is true and ascii_email is none because the local part of the address is internationalized the local_part and normalized fields return the normalized form of the address because of unicode normalization it is possible in edge cases for smtputf8 to be true based on the original email address when ascii_email is also present in the validatedemail return value when an email address passes validation the fields in the returned object are field value normalized the normalized form of the email address that you should put in your database this combines the local_part and domain fields see below ascii_email if set an ascii only form of the normalized email address by replacing the domain part with idna punycode this field will be present when an ascii only form of the email address exists including if the email address is already ascii if the local part of the email address contains internationalized characters ascii_email will be none if set it merely combines ascii_local_part and ascii_domain local_part the normalized local part of the given email address before the sign normalization includes unicode nfc normalization and removing unnecessary quoted string quotes and backslashes if allow_quoted_local is true and the surrounding quotes are necessary the quotes will be present in this field ascii_local_part if set the local part which is composed of ascii characters only domain the canonical internationalized unicode form of the domain part of the email address if the returned string contains non ascii characters either the smtputf8 feature of your mail relay will be required to transmit the message or else the email address s domain part must be converted to idna ascii first use ascii_domain field instead ascii_domain the idna punycode encoded form of the domain part of the given email address as it would be transmitted on the wire domain_address if domain literals are allowed and if the email address contains one an ipaddress ipv4address or ipaddress ipv6address object display_name if no display name was present and angle brackets do not surround the address this will be none otherwise it will be set to the display name or the empty string if there were angle brackets but no display name if the display name was quoted it will be unquoted and unescaped smtputf8 a boolean indicating that the smtputf8 ...
|