ListMailDomainsCommand

Lists the mail domains in a given WorkMail organization.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { WorkMailClient, ListMailDomainsCommand } from "@aws-sdk/client-workmail"; // ES Modules import
// const { WorkMailClient, ListMailDomainsCommand } = require("@aws-sdk/client-workmail"); // CommonJS import
const client = new WorkMailClient(config);
const input = { // ListMailDomainsRequest
  OrganizationId: "STRING_VALUE", // required
  MaxResults: Number("int"),
  NextToken: "STRING_VALUE",
};
const command = new ListMailDomainsCommand(input);
const response = await client.send(command);
// { // ListMailDomainsResponse
//   MailDomains: [ // MailDomains
//     { // MailDomainSummary
//       DomainName: "STRING_VALUE",
//       DefaultDomain: true || false,
//     },
//   ],
//   NextToken: "STRING_VALUE",
// };

ListMailDomainsCommand Input

See ListMailDomainsCommandInput for more details

Parameter
Type
Description
OrganizationId
Required
string | undefined

The WorkMail organization for which to list domains.

MaxResults
number | undefined

The maximum number of results to return in a single call.

NextToken
string | undefined

The token to use to retrieve the next page of results. The first call does not require a token.

ListMailDomainsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
MailDomains
MailDomainSummary[] | undefined

The list of mail domain summaries, specifying domains that exist in the specified WorkMail organization, along with the information about whether the domain is or isn't the default.

NextToken
string | undefined

The token to use to retrieve the next page of results. The value becomes null when there are no more results to return.

Throws

Name
Fault
Details
InvalidParameterException
client

One or more of the input parameters don't match the service's restrictions.

OrganizationNotFoundException
client

An operation received a valid organization identifier that either doesn't belong or exist in the system.

OrganizationStateException
client

The organization must have a valid state to perform certain operations on the organization or its members.

WorkMailServiceException
Base exception class for all service exceptions from WorkMail service.