Soenneker.Validators.Email.Mx 4.0.2734

Prefix Reserved
dotnet add package Soenneker.Validators.Email.Mx --version 4.0.2734
                    
NuGet\Install-Package Soenneker.Validators.Email.Mx -Version 4.0.2734
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Validators.Email.Mx" Version="4.0.2734" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Validators.Email.Mx" Version="4.0.2734" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Validators.Email.Mx" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Validators.Email.Mx --version 4.0.2734
                    
#r "nuget: Soenneker.Validators.Email.Mx, 4.0.2734"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Validators.Email.Mx@4.0.2734
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Validators.Email.Mx&version=4.0.2734
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Validators.Email.Mx&version=4.0.2734
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Validators.Email.Mx

Queries DNS for MX records on a domain or on the domain extracted from an email-shaped string.

Install

dotnet add package Soenneker.Validators.Email.Mx

Registration

using Soenneker.Validators.Email.Mx.Registrars;
using Microsoft.Extensions.DependencyInjection;

services.AddEmailMxValidatorAsSingleton();

AddEmailMxValidatorAsScoped() is also available. The scoped validator still reuses the singleton DNS client utility; disposing the scope does not discard that shared DNS client state. The singleton registration uses singleton dependencies throughout.

Query a domain

using Soenneker.Validators.Email.Mx.Abstract;

bool hasMx = await validator.Validate(
    "example.com",
    cancellationToken);

The result is true when the DNS response contains at least one MX answer and false when the response reports an error or contains no MX answers. The method does not validate or normalize domain syntax before querying.

Query an email domain

bool hasMx = await validator.ValidateEmail(
    "person@example.com",
    cancellationToken);

ValidateEmail extracts the text after the last @. It returns false when non-empty text cannot be extracted on both sides, then delegates to the domain query. This is not mailbox syntax validation and does not trim input or normalize internationalized domain names.

What an MX result means

A true result proves only that the resolver returned an MX record. It does not prove that a mailbox exists, accepts mail, or belongs to a user. The validator does not connect to an SMTP server and does not apply the implicit-A/AAAA fallback used by mail delivery when MX records are absent.

DNS response errors are returned as false. Transport failures and cancellation from the DNS client propagate to the caller. DNS answers can change and may be cached by the underlying resolver, so do not persist this result as permanent deliverability state.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2734 38 9/9/2026
4.0.2733 36 9/9/2026
4.0.2732 42 9/9/2026
4.0.2731 46 9/9/2026
4.0.2730 49 9/8/2026
4.0.2729 47 9/8/2026
4.0.2728 46 9/8/2026
4.0.2727 76 9/8/2026
4.0.2726 77 9/8/2026
4.0.2724 78 9/7/2026
4.0.2723 92 9/7/2026
4.0.2722 92 9/7/2026
4.0.2721 86 9/7/2026
4.0.2720 94 9/5/2026
4.0.2719 84 9/5/2026
4.0.2718 95 9/5/2026
4.0.2717 87 9/4/2026
4.0.2715 89 9/4/2026
4.0.2714 77 9/4/2026
4.0.2713 81 9/4/2026
Loading failed

Update dependency Soenneker.Utils.String to 4.0.3206 (#3274)