Skip to main content

mail_domains

Creates, updates, deletes, gets or lists a mail_domains resource.

Overview

Namemail_domains
TypeResource
Idaws.workmail.mail_domains

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
dkim_verification_statusstringIndicates the status of a DKIM verification. (PENDING, VERIFIED, FAILED)
is_defaultbooleanSpecifies whether the domain is the default domain for your organization.
is_test_domainbooleanSpecifies whether the domain is a test domain provided by WorkMail, or a custom domain.
ownership_verification_statusstringIndicates the status of the domain ownership verification. (PENDING, VERIFIED, FAILED)
recordsarrayA list of the DNS records that WorkMail recommends adding in your DNS provider for the best user experience. The records configure your domain with DMARC, SPF, DKIM, and direct incoming email traffic to SES. See admin guide for more details.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_mail_domainselectregionGets details for a mail domain, including domain records required to configure your domain with recommended security.
list_mail_domainsselectregionLists the mail domains in a given WorkMail organization.
register_mail_domaininsertregion, OrganizationId, DomainNameRegisters a new domain in WorkMail and SES, and configures it for use by WorkMail. Emails received by SES for this domain are routed to the specified WorkMail organization, and WorkMail has permanent permission to use the specified domain for sending your users' emails.
update_default_mail_domainupdateregion, OrganizationId, DomainNameUpdates the default mail domain for an organization. The default mail domain is used by the WorkMail AWS Console to suggest an email address when enabling a mail user. You can only have one default domain.
deregister_mail_domaindeleteregionRemoves a domain from WorkMail, stops email routing to WorkMail, and removes the authorization allowing WorkMail use. SES keeps the domain because other applications may use it. You must first remove any email address used by WorkMail entities before you remove the domain.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Gets details for a mail domain, including domain records required to configure your domain with recommended security.

SELECT
dkim_verification_status,
is_default,
is_test_domain,
ownership_verification_status,
records
FROM aws.workmail.mail_domains
WHERE region = '{{ region }}' -- required
;

INSERT examples

Registers a new domain in WorkMail and SES, and configures it for use by WorkMail. Emails received by SES for this domain are routed to the specified WorkMail organization, and WorkMail has permanent permission to use the specified domain for sending your users' emails.

INSERT INTO aws.workmail.mail_domains (
ClientToken,
OrganizationId,
DomainName,
region
)
SELECT
'{{ ClientToken }}',
'{{ OrganizationId }}' /* required */,
'{{ DomainName }}' /* required */,
'{{ region }}'
;

UPDATE examples

Updates the default mail domain for an organization. The default mail domain is used by the WorkMail AWS Console to suggest an email address when enabling a mail user. You can only have one default domain.

UPDATE aws.workmail.mail_domains
SET
OrganizationId = '{{ OrganizationId }}',
DomainName = '{{ DomainName }}'
WHERE
region = '{{ region }}' --required
AND OrganizationId = '{{ OrganizationId }}' --required
AND DomainName = '{{ DomainName }}' --required;

DELETE examples

Removes a domain from WorkMail, stops email routing to WorkMail, and removes the authorization allowing WorkMail use. SES keeps the domain because other applications may use it. You must first remove any email address used by WorkMail entities before you remove the domain.

DELETE FROM aws.workmail.mail_domains
WHERE region = '{{ region }}' --required
;