Can Holehe Check Email Validity? A Technical Breakdown of Email Verification Methods
Holehe validates email addresses through syntax checking and service-specific existence verification across hundreds of platforms, but does not perform low-level SMTP or mailbox-reachability tests.
Holehe is an open-source OSINT tool maintained by megadose that checks whether an email address is registered on various websites. Understanding how holehe checks email validity requires examining its two-stage validation process implemented in the Python source code. The tool distinguishes between syntactically correct email formatting and actual existence on supported services.
How Holehe Validates Email Addresses
According to the megadose/holehe source code, the tool implements a two-tier validation system that separates format verification from service-side existence checks.
Stage 1: Syntax Validation with Regular Expressions
Before initiating any network requests, holehe validates the email string against a compiled regex pattern defined as EMAIL_FORMAT in holehe/core.py (lines 31-33). The is_email() function applies this pattern to confirm the address follows standard RFC-style formatting.
If the syntax check fails, the program aborts immediately with a usage message. In holehe/core.py lines 94-105, the CLI logic enforces this validation before proceeding to module execution, ensuring malformed strings like user@.com trigger an immediate error without wasting network resources.
Stage 2: Service-Side Existence Verification
After syntax validation passes, holehe queries hundreds of distinct web services to determine if the email is registered. These checks occur through modular components located in holehe/modules/, such as holehe/modules/mails/google.py and holehe/modules/mails/mail_ru.py.
Each module implements an asynchronous function with the signature async def <service_name>(email, client, out), where:
emailis the validated stringclientis an HTTPX async client instanceoutis a list that collects results
Modules return a boolean exists field in their output dictionaries, indicating whether the credential appears in the target service's database. Notably, holehe does not perform SMTP handshake verification or inbox delivery tests; it relies solely on registration-status leakage through public APIs and registration forms.
Practical Methods to Check Email Validity with Holehe
You can leverage holehe's validation capabilities through both command-line and programmatic interfaces.
Command-Line Interface
The CLI provides immediate syntax feedback before executing service checks:
holehe user@example.com
If the address fails the regex validation in holehe/core.py, the tool returns:
[-] Please enter a target email !
Example : holehe email@example.com
For syntactically valid addresses, holehe proceeds to contact enabled services, returning output formatted as:
[+] amazon.com
[-] github.com
[x] rate-limited-site.com
Python API for Syntax Validation
Import the is_email function directly from the core module to validate format without network overhead:
from holehe.core import is_email
email = "test@example.com"
if is_email(email):
print("Syntax is valid – you can run holehe scans.")
else:
print("Invalid e-mail format.")
This function utilizes the same EMAIL_FORMAT regex compiled in holehe/core.py, providing a lightweight way to pre-validate addresses before invoking the full scanner.
Programmatic Service Verification
For targeted validation against specific platforms, invoke individual modules directly using httpx and trio:
import httpx
import trio
from holehe.modules.mails.google import google
async def check_google():
async with httpx.AsyncClient() as client:
out = []
await google("test@example.com", client, out)
result = out[0]
print(f"Exists: {result['exists']}")
print(f"Service: {result['name']}")
trio.run(check_google)
Each module returns a standardized dictionary containing keys such as exists, emailrecovery, and others, enabling programmatic parsing of registration status across supported services.
Core Implementation Files
Understanding the email validation architecture requires examining these specific source files:
-
holehe/core.py– Contains the globalEMAIL_FORMATregex,is_email()validator, CLI argument parsing (lines 94-105), and the orchestration logic that coordinates all service modules. -
holehe/modules/mails/google.py– Representative mail-service module implementing the async signature to query Google's account recovery endpoints for email existence. -
holehe/modules/__init__.py– Exposes all service modules for dynamic import during the validation workflow. -
holehe/modules/mails/__init__.py– Registers mail-related modules used by the scanner's module loader.
Summary
- Holehe performs syntax validation using regex before any network activity occurs, aborting immediately on malformed addresses.
- The tool checks email existence across hundreds of services through modular async queries, not through SMTP verification.
- Source code in
holehe/core.pyhandles the initialis_email()validation, whileholehe/modules/contains service-specific implementations. - You can use holehe via CLI, import
is_emailfor standalone syntax checking, or invoke individual modules programmatically. - The
existsboolean in module output indicates registration status on the target service, not inbox deliverability.
Frequently Asked Questions
Does holehe verify if an email inbox actually exists?
No. Holehe only checks whether an email address is syntactically valid and whether it appears in registration databases of supported services. It does not perform SMTP RCPT TO verification or confirm that the mailbox can receive messages.
What regex pattern does holehe use for syntax validation?
The pattern is defined as EMAIL_FORMAT in holehe/core.py (lines 31-33) and compiled for use in the is_email() function. This regex validates standard email formatting before the tool proceeds to service checks.
Can I use holehe as a Python library for email validation?
Yes. You can import is_email from holehe.core to validate syntax programmatically without CLI overhead. For service-specific checks, import individual modules from holehe.modules and invoke them with an httpx.AsyncClient and trio event loop.
How many services does holehe check for email existence?
Holehe supports hundreds of distinct modules located in holehe/modules/, covering categories including mail providers, social networks, and shopping platforms. The exact count varies by version as the repository maintains an expanding ecosystem of service-specific checkers.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →