---
name: "firedns_resolvemxalist"
section: "3"
platform: "linux"
package: "libfiredns-dev"
version: "0.9.12+dfsg-1"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/firedns_resolvemxalist"
---

# firedns\_resolvemxalist(3)

Resolve a list of MX records of a hostname and their corresponding A records

## NAME

firedns\_resolvemxalist - Resolve a list of MX records of a hostname and their corresponding A records

## SYNOPSIS

**#include \<firedns.h\>**\
 **-lfiredns**

**struct firedns\_mxlist \*firedns\_resolvemxalist(const char \* const** *name***)**

## DESCRIPTION

firedns\_resolvemxalist() attempts to resolve a list of MX records for the hostname *name*. If it fails, it treats the host as having a priority 0 MX record, and attempts to resolve a list of A and AAAA records for the hostname.  If the MX record lookup succeeds, it looks up the list of A and AAAA records for each MX record in parallel.  It also checks for RFC-violating CNAMEs for each MX record.

## RETURN VALUE

Returns a pointer to an internal static *struct firedns\_mxlist \**. This structure is the first of a linked list.  It contains:

	char \*name;\
\
 	char \*cname;\
\
 	struct firedns\_ip4list \*ip4list;\
\
 	struct firedns\_ip6list \*ip6list;\
\
 	unsigned int protocol; (*FIREDNS\_MX\_SMTP* or *FIREDNS\_MX\_QMTP*)\
\
 	unsigned int priority;\
\
 	struct firedns\_mxlist \*next;

This function returns NULL on error.

Any result return by this function should be freed with [*firedns\_free\_mxalist*(3)](/firedns_free_mxalist/3.md).

## AUTHOR

Ian Gulliver \<ian@penguinhosting.net\>

## SEE ALSO

[**libfiredns**(3)](/libfiredns/3.md)\
 [**firedns\_free\_mxalist**(3)](/firedns_free_mxalist/3.md)
