Inferensys

Prompt

Email Address Normalization Prompt Template

A practical prompt playbook for standardizing email addresses from model outputs, with RFC compliance checks, alias resolution, and disposable email detection.
Security analyst reviewing fraud detection AI on multiple screens, alert dashboards visible, dark mode monitoring setup.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, ideal user, and operational boundaries for the email normalization prompt before integrating it into a production pipeline.

This prompt is designed for CRM integrators, data engineers, and identity resolution teams who need to clean and standardize email addresses produced by large language models. The core job-to-be-done is transforming a raw, potentially malformed email string from a model's output into an RFC-compliant, deduplicatable identifier suitable for ingestion into a customer data platform or system of record. It handles common model failure modes such as hallucinated domains, missing '@' symbols, inconsistent alias handling (plus-addressing), and the inclusion of display names or angle brackets. Use this when your pipeline receives email addresses as part of a larger unstructured or semi-structured model response, and you cannot trust the upstream model to have performed validation itself.

You should reach for this prompt when downstream systems require strict format compliance (e.g., a CRM API that rejects invalid emails) or when you need to deduplicate contacts across multiple sources. The prompt is built to resolve common ambiguities: it normalizes Gmail's dot-ignoring behavior, strips sub-addresses when instructed, corrects known domain typos (e.g., 'gmial.com' to 'gmail.com'), and flags disposable email addresses from a reference list. It is not a replacement for a full email verification service (SMTP check, mailbox existence), but it acts as a critical pre-flight repair step that reduces downstream validation failures and duplicate records. The ideal user is an engineer building a data pipeline who needs a reliable, testable normalization function that can be evaluated against a golden dataset of known inputs and expected outputs.

Do not use this prompt for real-time user-facing validation during account sign-up. In that context, a deterministic library running client-side is faster, cheaper, and more predictable. This prompt is also inappropriate for generating or inferring email addresses that were not present in the input; its job is normalization, not enrichment. Avoid using it as a spam classification tool—while it detects disposable domains, it does not assess email reputation or deliverability. Finally, if your pipeline handles Personally Identifiable Information (PII) subject to GDPR or similar regulations, ensure that the prompt's execution environment and logging practices are compliant. The prompt itself should not log or store raw email addresses outside of approved data processing boundaries. Before deploying, pair this prompt with a validation harness that checks for false-positive domain corrections and unintended alias stripping, as these are the most common production failure modes.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Email Address Normalization prompt template delivers value and where it introduces risk. Use these cards to decide if this prompt fits your pipeline before wiring it into production.

01

Good Fit: CRM Data Cleansing Pipelines

Use when: you have model-generated email addresses flowing into a CRM and need RFC-compliant normalization, alias resolution, and disposable email detection before ingestion. Guardrail: run the prompt as a post-extraction repair step, not as the primary extraction method.

02

Bad Fit: Real-Time User Registration

Avoid when: latency budgets are under 200ms or the system must validate emails synchronously during signup. Guardrail: use deterministic regex and DNS MX lookups for real-time validation; reserve this prompt for batch cleanup of existing records.

03

Required Input: Raw Email String Plus Context

What to watch: the prompt needs the raw email string and optional context like user-provided domain hints or known typos. Without context, domain correction accuracy drops significantly. Guardrail: always pass the original extraction source as context to improve domain disambiguation.

04

Operational Risk: False-Positive Domain Corrections

What to watch: the model may over-correct valid but unusual domains (e.g., .co to .com) or misclassify legitimate business domains as disposable. Guardrail: implement a domain allowlist for known-good domains and require human review for corrections flagged below a confidence threshold.

05

Operational Risk: Plus-Address Handling Inconsistency

What to watch: some pipelines need plus-address preservation for filtering, while others need alias stripping for deduplication. The prompt may apply the wrong strategy. Guardrail: make plus-address behavior an explicit boolean parameter in the prompt template and test both paths in eval.

06

Scale Risk: Batch Processing Without Rate Limiting

What to watch: normalizing millions of emails through a model endpoint can exhaust rate limits, blow cost budgets, and produce inconsistent results across batches. Guardrail: implement chunked processing with idempotency keys, log per-batch normalization stats, and cache results for duplicate inputs.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for normalizing email addresses from model outputs into RFC-compliant, deduplicatable records.

This template provides the core instruction set for an LLM to act as an email normalization engine. It accepts a raw email address string—often malformed, inconsistently cased, or containing display names—and returns a structured JSON object with the normalized address, domain correction flags, alias resolution, and disposable email detection. The prompt is designed to be dropped into a post-generation repair pipeline where upstream model outputs require canonicalization before ingestion into a CRM, CDP, or identity resolution system.

code
SYSTEM:
You are an email normalization engine. Your job is to take a raw email address string and return a strictly valid JSON object following the [OUTPUT_SCHEMA]. Apply the normalization rules below. Do not invent information. If the input is not a valid or repairable email address, set the `valid` field to `false` and provide a reason.

NORMALIZATION RULES:
1. Trim whitespace and remove display names (e.g., "John Doe <john@example.com>" becomes "john@example.com").
2. Lowercase the local part and domain.
3. For known provider domains (Gmail, Googlemail, Outlook, Hotmail, Yahoo, Yandex, Protonmail, Zoho, iCloud, Fastmail):
   a. Remove dots from the local part for Gmail/Googlemail addresses.
   b. Resolve plus-address aliases by extracting the base address and the tag separately.
   c. Correct common domain typos using the [DOMAIN_CORRECTION_MAP].
4. Flag the address if the domain is a known disposable email provider from [DISPOSABLE_DOMAIN_LIST].
5. Flag the address if the domain has invalid MX records based on [MX_CHECK_RESULTS].
6. Do not alter the domain for non-provider addresses beyond lowercasing and typo correction.

[OUTPUT_SCHEMA]:
{
  "original": "string (the raw input)",
  "normalized": "string (the cleaned email address)",
  "valid": "boolean",
  "reason": "string (explanation if invalid)",
  "flags": {
    "is_disposable": "boolean",
    "is_plus_address": "boolean",
    "plus_tag": "string | null",
    "domain_corrected": "boolean",
    "original_domain": "string | null",
    "mx_valid": "boolean | null"
  },
  "base_address": "string | null (the address without plus tag, if applicable)"
}

[CONSTRAINTS]:
- Return ONLY the JSON object. No markdown fences, no commentary.
- If the domain was corrected, set `domain_corrected` to `true` and include the `original_domain`.
- If the input is irreparably malformed (e.g., missing @, invalid characters after cleaning), set `valid` to `false` and `normalized` to `null`.

USER:
Normalize this email address: [INPUT]

To adapt this template, replace the square-bracket placeholders with your specific configuration. [INPUT] receives the raw email string from your upstream model output. [DOMAIN_CORRECTION_MAP] should be a JSON object mapping common typos to correct domains (e.g., {"gmial.com": "gmail.com", "yaho.com": "yahoo.com"}). [DISPOSABLE_DOMAIN_LIST] should be a JSON array of known disposable email domains. [MX_CHECK_RESULTS] should be a boolean or null value from your DNS validation layer. If you don't have MX check infrastructure, remove that rule and the mx_valid field from the schema. For high-volume pipelines, consider caching the domain correction map and disposable domain list outside the prompt to reduce token usage and latency.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the email normalization prompt. Validate each input before calling the model to prevent downstream normalization errors.

PlaceholderPurposeExampleValidation Notes

[EMAIL_INPUT]

Raw email address string from model output or user input

Required. Must be a non-empty string. Reject null or whitespace-only inputs before prompt assembly.

[NORMALIZATION_RULES]

Specific normalization directives: alias resolution, domain correction, case folding

resolve_aliases: true, fix_common_domains: true, lowercase_local: false

Required. Must be a valid JSON object with boolean flags. Default to strict RFC compliance if not specified.

[DISPOSABLE_DOMAIN_LIST]

Reference list of known disposable email domains for detection

['mailinator.com', 'guerrillamail.com', '10minutemail.com']

Optional. If provided, must be a valid JSON array of strings. Null allowed; prompt should skip disposable detection if absent.

[DOMAIN_CORRECTION_MAP]

Known domain typo mappings for common providers

{'gmial.com': 'gmail.com', 'hotnail.com': 'hotmail.com'}

Optional. Must be a valid JSON object with string keys and values. Validate no empty strings as keys or values.

[PROVIDER_ALIAS_RULES]

Provider-specific alias handling rules for plus addressing and dots

{'gmail.com': {'strip_dots': true, 'strip_plus': true}}

Optional. Must be a valid JSON object keyed by domain. Each domain value must be an object with boolean flags. Null allowed.

[OUTPUT_SCHEMA]

Expected output structure for the normalized result

{'normalized_email': string, 'original_email': string, 'is_disposable': boolean, 'corrections_applied': string[]}

Required. Must be a valid JSON Schema or type definition object. Validate schema is parseable before prompt assembly.

[RFC_COMPLIANCE_LEVEL]

Strictness level for RFC 5321/5322 compliance checking

strict | relaxed | permissive

Required. Must be one of the enumerated string values. Default to 'relaxed' if not specified. Reject unknown values.

[LOCALE_HINT]

Regional context for domain normalization when ambiguous

en-US | de-DE | null

Optional. Must be a valid locale string or null. Used for country-specific TLD normalization. Null means no locale preference.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the email normalization prompt into a production application with validation, retries, and safe defaults.

This prompt is designed to be called as a post-generation repair step, not as the primary extraction prompt. The typical integration pattern is: (1) your upstream model or pipeline produces a raw email string, (2) you run basic syntax validation, and (3) if validation fails or you require canonicalization, you invoke this prompt with the raw email as [INPUT]. This separation keeps your primary prompt fast and delegates normalization to a dedicated, testable step that can be versioned and monitored independently.

Wire the prompt into an idempotent normalization function that accepts a raw email string and returns a structured result. The function should: validate the input is a non-empty string, call the LLM with the prompt template, parse the JSON response, and validate the output against an expected schema (normalized_email, normalization_performed, disposable, warnings). If the model returns malformed JSON, use a JSON repair step (from the Malformed JSON and Structured Format Repair pillar) before retrying. Implement a maximum of 2 retries with exponential backoff; if normalization still fails, return the original email with normalization_performed: false and a warnings entry indicating repair failure. This prevents the normalization step from becoming a blocking failure point in your pipeline.

For domain correction, maintain an allowlist of known provider domains (gmail.com, yahoo.com, outlook.com, etc.) and their common typos. The prompt should only correct domains when there is a high-confidence match against this list. Log every domain correction with the original and corrected values for auditability. For plus-address handling (e.g., user+tag@domain.com), the prompt should preserve the local part but note the alias in normalization_performed. If your application requires alias stripping, make this a configurable parameter passed via [CONSTRAINTS] rather than hardcoding it into the prompt. This lets different downstream systems apply different alias policies without maintaining separate prompts.

Disposable email detection should be treated as a flag, not a block. The prompt returns disposable: true when the domain matches known disposable providers. Your application harness should decide whether to reject, quarantine, or flag these records based on business rules. Maintain a regularly updated disposable domain list and consider supplementing the LLM check with a deterministic lookup for known domains, using the LLM primarily for catching new or obscure disposable services. Log disposable detection rates to monitor for false positives that could block legitimate users.

Model selection matters for this task. Use a fast, cost-effective model (e.g., GPT-4o-mini, Claude Haiku, or a fine-tuned small model) because normalization is a high-volume, low-complexity operation. Avoid using large models for this step unless you are also performing complex reasoning about ambiguous addresses. If processing batches, implement concurrent requests with a semaphore to control rate limits, and collect results with per-record error handling so one failed normalization does not block the entire batch.

Before deploying, build an eval harness using the Contact Canonicalization Eval Rubric from this pillar. Test against a golden dataset that includes: valid RFC-compliant addresses, common typos (gmial.com, yaho.com), plus-address variants, disposable domains, internationalized email addresses, and edge cases like quoted local parts. Measure precision on domain correction (false-positive corrections erode user trust) and recall on disposable detection. Set a minimum precision threshold of 99.5% for domain corrections before enabling automatic correction in production; below that threshold, flag for human review instead. Monitor these metrics in production and trigger a prompt review if correction precision drops.

PRACTICAL GUARDRAILS

Common Failure Modes

Email normalization prompts fail in predictable ways. These cards cover the most common production failure modes and the specific guardrails that catch them before they corrupt downstream systems.

01

Over-Aggressive Domain Correction

What to watch: The model 'fixes' valid but unusual domains (e.g., @example.co.uk becomes @example.com) or corrects intentional typos in disposable email services. This destroys valid addresses and creates false duplicates. Guardrail: Maintain an allowlist of known valid domains and TLDs. Require the model to flag any domain change with a domain_correction_reason field. If the original domain passes DNS MX lookup, prefer the original.

02

Plus-Address and Alias Mishandling

What to watch: The model strips plus-address tags (user+tag@domain.com) without explicit instruction, or inconsistently resolves Gmail dot-aliases (user.name vs username). This breaks user-specific routing and creates duplicate records when alias resolution is partial. Guardrail: Make plus-address handling an explicit parameter (preserve_plus_alias, strip_plus_alias, resolve_to_base). Require the model to output both the original and resolved form. Test with a fixed suite of alias variants before deployment.

03

Disposable Email False Positives

What to watch: The model flags legitimate domains (especially newer or regional providers) as disposable, or misses actual disposable domains that aren't in common blocklists. Over-blocking rejects real users; under-blocking lets throwaway addresses into CRM. Guardrail: Use an external disposable domain detection service rather than relying on model knowledge. Have the model output a disposable_confidence score and route low-confidence cases for human review. Never hard-reject based solely on model classification.

04

RFC Compliance Drift on Edge Cases

What to watch: The model mishandles quoted local parts ("user@domain"@example.com), IPv6 literal domains, or internationalized email addresses (EAI). These rare but valid formats get normalized into invalid forms or rejected entirely. Guardrail: Include RFC 5321 and RFC 6531 edge cases in your eval suite. Require the model to output a format_type field (standard, quoted_local, ipv6_domain, internationalized). If the input is valid per RFC, the output must also be valid.

05

Silent Truncation and Character Loss

What to watch: Token limits or model early-stopping cause truncated email addresses in batch processing. A partial email (user@dom) passes syntax checks but is wrong. Streaming interruptions produce incomplete records that downstream systems accept as valid. Guardrail: Always validate output length against input length. If the normalized email is shorter than expected and doesn't match a known correction pattern, flag it. Implement post-generation completeness checks before the output enters any database.

06

Encoding Artifact Injection

What to watch: The model introduces invisible characters (zero-width spaces, non-breaking spaces, Unicode homoglyphs) during normalization, especially when processing internationalized inputs. These pass visual inspection but break exact-match deduplication and SMTP delivery. Guardrail: Run all normalized outputs through a character sanitization step that strips control characters, normalizes Unicode (NFC), and rejects addresses containing characters outside the RFC-allowed set. Add homoglyph detection for lookalike domain characters.

IMPLEMENTATION TABLE

Evaluation Rubric

Test criteria for evaluating the Email Address Normalization Prompt Template before shipping. Use these checks to catch false-positive domain fixes, mishandled plus-addresses, and over-normalization that breaks valid RFC-compliant addresses.

CriterionPass StandardFailure SignalTest Method

RFC 5321/5322 Compliance

Output passes a standard email parser (e.g., Python email-validator) with deliverability check enabled

Parser raises syntax error or flags address as undeliverable

Run 100 generated outputs through email-validator library; 0% parse failures

Plus-Address Preservation

[INPUT] contains user+tag@domain and [OUTPUT] retains the +tag portion unchanged

Plus-address is stripped, tag is removed, or alias resolution converts it to base address without explicit instruction

Test 20 plus-address variants against prompt; verify exact local-part preservation in output

Domain Typo Correction Precision

Corrects known common typos (gmial→gmail, hotnail→hotmail) but does not alter valid unusual domains (e.g., .co, .io, subdomain.company.com)

Valid domain is rewritten to a more common domain or TLD is incorrectly changed

Run 50 valid unusual domains through prompt; 0% false-positive corrections. Run 50 known-typo domains; >95% true-positive corrections

Disposable Email Detection

Flags known disposable domains (e.g., mailinator.com, 10minutemail.com) with disposable: true in output contract

Disposable domain not flagged, or legitimate domain incorrectly flagged as disposable

Test 30 known disposable domains and 30 legitimate domains; >95% precision and recall

Alias Resolution Control

When [CONSTRAINTS] specifies resolve_aliases: false, Gmail dots and plus-addresses are preserved. When resolve_aliases: true, dots are stripped and plus-addresses resolved per provider rules

Alias resolution applied or not applied contrary to constraint setting

Run same 20 inputs with both constraint settings; verify output matches expected resolution behavior for each

Encoding Artifact Removal

Removes visible encoding artifacts (e.g., =40 instead of @, double-encoded characters) and produces clean ASCII local-part and domain

Encoding artifact remains in output or decoding produces invalid character in local-part

Test 15 addresses with common encoding artifacts; 100% artifact removal with valid resulting address

International Email Handling (EAI)

UTF-8 local parts and IDN domains are preserved or Punycode-converted per [CONSTRAINTS] without corruption

Non-ASCII characters are stripped, replaced with ASCII approximations, or domain is dropped entirely

Test 10 valid international email addresses; 100% preservation of original characters or correct Punycode conversion as specified

Null and Empty Input Handling

[INPUT] is null, empty string, or whitespace-only and [OUTPUT] returns null or explicit "invalid" flag without hallucinating an address

Prompt fabricates an email address, returns a placeholder like no-reply@example.com, or crashes

Test 5 null/empty/whitespace inputs; 100% return null or explicit invalid flag with no fabricated content

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base template and strip it down to the core normalization rules. Remove the disposable email detection block, alias resolution, and domain correction logic. Use a single example instead of the full few-shot set. Run with temperature=0 and a simple pass/fail check against a handful of test addresses.

code
Normalize this email address: [RAW_EMAIL]

Rules:
- Lowercase the local part and domain
- Trim whitespace
- Remove dots from Gmail local parts only if you are certain it is Gmail
- Return JSON: {"normalized": "...", "original": "..."}

Watch for

  • Plus-address handling being inconsistent without explicit Gmail/ProtonMail rules
  • Domain typos passing through because you removed the correction block
  • No schema enforcement, so the model might return plain text instead of JSON
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.