Skip to content

Resource: awsSesDomainMailFrom

Provides an SES domain MAIL FROM resource.

\~> NOTE: For the MAIL FROM domain to be fully usable, this resource should be paired with the aws_ses_domain_identity resource. To validate the MAIL FROM domain, a DNS MX record is required. To pass SPF checks, a DNS TXT record may also be required. See the Amazon SES MAIL FROM documentation for more information.

Example Usage

Domain Identity MAIL FROM

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsSesDomainIdentityExample = new aws.sesDomainIdentity.SesDomainIdentity(
  this,
  "example",
  {
    domain: "example.com",
  }
);
const awsSesDomainMailFromExample = new aws.sesDomainMailFrom.SesDomainMailFrom(
  this,
  "example_1",
  {
    domain: awsSesDomainIdentityExample.domain,
    mailFromDomain: `bounce.\${${awsSesDomainIdentityExample.domain}}`,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSesDomainMailFromExample.overrideLogicalId("example");
new aws.route53Record.Route53Record(this, "example_ses_domain_mail_from_mx", {
  name: awsSesDomainMailFromExample.mailFromDomain,
  records: ["10 feedback-smtp.us-east-1.amazonses.com"],
  ttl: "600",
  type: "MX",
  zoneId: "${aws_route53_zone.example.id}",
});
new aws.route53Record.Route53Record(this, "example_ses_domain_mail_from_txt", {
  name: awsSesDomainMailFromExample.mailFromDomain,
  records: ["v=spf1 include:amazonses.com -all"],
  ttl: "600",
  type: "TXT",
  zoneId: "${aws_route53_zone.example.id}",
});

Email Identity MAIL FROM

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsSesEmailIdentityExample = new aws.sesEmailIdentity.SesEmailIdentity(
  this,
  "example",
  {
    email: "user@example.com",
  }
);
const awsSesDomainMailFromExample = new aws.sesDomainMailFrom.SesDomainMailFrom(
  this,
  "example_1",
  {
    domain: awsSesEmailIdentityExample.email,
    mailFromDomain: "mail.example.com",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSesDomainMailFromExample.overrideLogicalId("example");

Argument Reference

The following arguments are required:

  • domain - (Required) Verified domain name or email identity to generate DKIM tokens for.
  • mailFromDomain - (Required) Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

The following arguments are optional:

  • behaviorOnMxFailure - (Optional) The action that you want Amazon SES to take if it cannot successfully read the required MX record when you send an email. Defaults to useDefaultValue. See the SES API documentation for more information.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The domain name.

Import

MAIL FROM domain can be imported using the domain attribute, e.g.,

$ terraform import aws_ses_domain_mail_from.example example.com