Email Provider MXAPI

API

API Reference

classifyMx(mxHost: string): MxProviderInfo | undefined

Classifies a single MX hostname.

Parameters:

  • mxHost (string): The MX hostname (e.g. the exchange field of a DNS MX record)

Returns: MxProviderInfo ({ provider, type, display }), or undefined if the host is not recognized.

classifyMx("aspmx.l.google.com");
// → { provider: "google", type: "mailbox", display: "Google Workspace" }

classifyMxRecords(records): MxProviderInfo | undefined

Classifies a set of MX records, returning the provider of the primary (lowest-priority) recognized record.

Parameters:

  • records ({ exchange: string; priority: number }[]): The MX records to classify

Returns: MxProviderInfo | undefined

isSecureEmailGateway(mxHost: string): boolean

Reports whether an MX hostname belongs to a known Secure Email Gateway.

isSecureEmailGateway("eu-smtp-inbound-1.mimecast.com"); // → true
isSecureEmailGateway("aspmx.l.google.com"); // → false

Types

type MxProviderType = "free" | "mailbox" | "seg";

interface MxProviderInfo {
    provider: string; // stable identifier, e.g. "google"
    type: MxProviderType; // "mailbox" | "free" | "seg"
    display: string; // human-friendly label, e.g. "Google Workspace"
}

MX_PROVIDERS

The raw curated dataset is also exported as MX_PROVIDERS (with the patterns each provider matches) for advanced use.

import { MX_PROVIDERS } from "@visulima/email-provider-mx";
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues