Check MX records
GET /domains/mx-check — preflight a hostname's existing MX records before enabling receiving.
/domains/mx-checkA preflight for receiving: does a hostname already have MX records, and do they all point at our inbound host? Use it before pointing a domain's MX at us so you can warn about an existing mail provider (switching MX would redirect all of that domain's mail to us). Read-only; requires a read-scoped key.
namestringrequiredThe hostname to check, e.g. mail.yourdomain.com.
Request
curl "https://api.mailblastr.com/domains/mx-check?name=mail.yourdomain.com" \
-H "Authorization: Bearer $MAILBLASTR_API_KEY"import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr(process.env.MAILBLASTR_API_KEY);
const { data } = await mb.domains.mxCheck('mail.yourdomain.com');Response
{
"has_mx": true,
"ours": false,
"records": [
{ "exchange": "aspmx.l.google.com", "priority": 1 },
{ "exchange": "alt1.aspmx.l.google.com", "priority": 5 }
]
}has_mxbooleanoptionalWhether the hostname has any MX records at all.
oursbooleanoptionalWhether every MX record already points at our inbound host (i.e. receiving is ready).
recordsobject[]optionalThe discovered MX records, each { exchange, priority }, sorted by priority.
A missing name returns missing_required_field (400); an invalid domain returns validation_error (422). A hostname with no MX (or an unresolvable one) returns { has_mx: false, ours: false, records: [] }. See Errors.