Skip to main content
resolveMx - dns - Node documentation
function resolveMx

Usage in Deno

import { resolveMx } from "node:dns";
resolveMx(
hostname: string,
callback: (
err: ErrnoException | null,
addresses: MxRecord[],
) => void
,
): void

Deno compatibility

The ttl option is not supported.

Uses the DNS protocol to resolve mail exchange records (MX records) for the hostname. The addresses argument passed to the callback function will contain an array of objects containing both a priority and exchange property (e.g. [{priority: 10, exchange: 'mx.example.com'}, ...]).

Parameters

hostname: string
callback: (
err: ErrnoException | null,
addresses: MxRecord[],
) => void

Return Type

void