CDnsClient::GetMailExchange
INT GetMailExchange(
LPCTSTR lpszHostName,  
LPINT lpnPreference,  
LPTSTR lpszBuffer,  
INT cbBuffer  
);

The GetMailExchange method returns the mail exchange (MX) record information for the specified domain. This information, if it is provided, identifies a server responsible for processing mail for the given domain.

Parameters

lpszHostName
Pointer to the string which specifies the host name that information is to be returned about.
lpnPreference
Pointer to the integer which will contain the preference for the specified mail exchange host.
lpszBuffer
Pointer to the buffer which will contain the host information returned by the nameserver.
cbBuffer
Maximum number of bytes that may be copied into the specified buffer, including the null-byte terminator.

Return Value

If the method succeeds, the length of the buffer is returned. A return value of zero indicates that no information is available for the specified host. If the method fails, the return value is DNS_ERROR. To get extended error information, call GetLastError.

Remarks

The mail exchange record is typically used by mail delivery agents to determine what system is responsible for accepting mail addressed to a given domain. This method will return the first MX record provided by the server. Note that some domains may have multiple mail servers. To enumerate all of the mail exchange records for a domain, use the EnumMailExchanges method.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csdnsav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetHostByAddress, GetHostByName, GetHostInfo, GetHostServices, GetRecord, GetResolverAddress, RegisterServer, EnumMailExchanges


Copyright © 2008 Catalyst Development Corporation. All rights reserved.