MailFrom

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.DomainIdentity 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

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        // Example SES Domain Identity
        var exampleDomainIdentity = new Aws.Ses.DomainIdentity("exampleDomainIdentity", new Aws.Ses.DomainIdentityArgs
        {
            Domain = "example.com",
        });
        var exampleMailFrom = new Aws.Ses.MailFrom("exampleMailFrom", new Aws.Ses.MailFromArgs
        {
            Domain = exampleDomainIdentity.Domain,
            MailFromDomain = exampleDomainIdentity.Domain.Apply(domain => $"bounce.{domain}"),
        });
        // Example Route53 MX record
        var exampleSesDomainMailFromMx = new Aws.Route53.Record("exampleSesDomainMailFromMx", new Aws.Route53.RecordArgs
        {
            Name = exampleMailFrom.MailFromDomain,
            Records = 
            {
                "10 feedback-smtp.us-east-1.amazonses.com",
            },
            Ttl = 600,
            Type = "MX",
            ZoneId = aws_route53_zone.Example.Id,
        });
        // Example Route53 TXT record for SPF
        var exampleSesDomainMailFromTxt = new Aws.Route53.Record("exampleSesDomainMailFromTxt", new Aws.Route53.RecordArgs
        {
            Name = exampleMailFrom.MailFromDomain,
            Records = 
            {
                "v=spf1 include:amazonses.com -all",
            },
            Ttl = 600,
            Type = "TXT",
            ZoneId = aws_route53_zone.Example.Id,
        });
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/route53"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ses"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleDomainIdentity, err := ses.NewDomainIdentity(ctx, "exampleDomainIdentity", &ses.DomainIdentityArgs{
            Domain: pulumi.String("example.com"),
        })
        if err != nil {
            return err
        }
        exampleMailFrom, err := ses.NewMailFrom(ctx, "exampleMailFrom", &ses.MailFromArgs{
            Domain: exampleDomainIdentity.Domain,
            MailFromDomain: exampleDomainIdentity.Domain.ApplyT(func(domain string) (string, error) {
                return fmt.Sprintf("%v%v", "bounce.", domain), nil
            }).(pulumi.StringOutput),
        })
        if err != nil {
            return err
        }
        _, err = route53.NewRecord(ctx, "exampleSesDomainMailFromMx", &route53.RecordArgs{
            Name: exampleMailFrom.MailFromDomain,
            Records: pulumi.StringArray{
                pulumi.String("10 feedback-smtp.us-east-1.amazonses.com"),
            },
            Ttl:    pulumi.Int(600),
            Type:   pulumi.String("MX"),
            ZoneId: pulumi.String(aws_route53_zone.Example.Id),
        })
        if err != nil {
            return err
        }
        _, err = route53.NewRecord(ctx, "exampleSesDomainMailFromTxt", &route53.RecordArgs{
            Name: exampleMailFrom.MailFromDomain,
            Records: pulumi.StringArray{
                pulumi.String("v=spf1 include:amazonses.com -all"),
            },
            Ttl:    pulumi.Int(600),
            Type:   pulumi.String("TXT"),
            ZoneId: pulumi.String(aws_route53_zone.Example.Id),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

# Example SES Domain Identity
example_domain_identity = aws.ses.DomainIdentity("exampleDomainIdentity", domain="example.com")
example_mail_from = aws.ses.MailFrom("exampleMailFrom",
    domain=example_domain_identity.domain,
    mail_from_domain=example_domain_identity.domain.apply(lambda domain: f"bounce.{domain}"))
# Example Route53 MX record
example_ses_domain_mail_from_mx = aws.route53.Record("exampleSesDomainMailFromMx",
    name=example_mail_from.mail_from_domain,
    records=["10 feedback-smtp.us-east-1.amazonses.com"],
    ttl="600",
    type="MX",
    zone_id=aws_route53_zone["example"]["id"])
# Example Route53 TXT record for SPF
example_ses_domain_mail_from_txt = aws.route53.Record("exampleSesDomainMailFromTxt",
    name=example_mail_from.mail_from_domain,
    records=["v=spf1 include:amazonses.com -all"],
    ttl="600",
    type="TXT",
    zone_id=aws_route53_zone["example"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Example SES Domain Identity
const exampleDomainIdentity = new aws.ses.DomainIdentity("example", {
    domain: "example.com",
});
const exampleMailFrom = new aws.ses.MailFrom("example", {
    domain: exampleDomainIdentity.domain,
    mailFromDomain: pulumi.interpolate`bounce.${exampleDomainIdentity.domain}`,
});
// Example Route53 MX record
const exampleSesDomainMailFromMx = new aws.route53.Record("example_ses_domain_mail_from_mx", {
    name: exampleMailFrom.mailFromDomain,
    records: ["10 feedback-smtp.us-east-1.amazonses.com"], // Change to the region in which `aws_ses_domain_identity.example` is created
    ttl: 600,
    type: "MX",
    zoneId: aws_route53_zone_example.id,
});
// Example Route53 TXT record for SPF
const exampleSesDomainMailFromTxt = new aws.route53.Record("example_ses_domain_mail_from_txt", {
    name: exampleMailFrom.mailFromDomain,
    records: ["v=spf1 include:amazonses.com -all"],
    ttl: 600,
    type: "TXT",
    zoneId: aws_route53_zone_example.id,
});

Create a MailFrom Resource

def MailFrom(resource_name, opts=None, behavior_on_mx_failure=None, domain=None, mail_from_domain=None, __props__=None);
func NewMailFrom(ctx *Context, name string, args MailFromArgs, opts ...ResourceOption) (*MailFrom, error)
public MailFrom(string name, MailFromArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args MailFromArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MailFromArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MailFromArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

MailFrom Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The MailFrom resource accepts the following input properties:

Domain string

Verified domain name to generate DKIM tokens for.

MailFromDomain string

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

BehaviorOnMxFailure string

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.

Domain string

Verified domain name to generate DKIM tokens for.

MailFromDomain string

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

BehaviorOnMxFailure string

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.

domain string

Verified domain name to generate DKIM tokens for.

mailFromDomain string

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

behaviorOnMxFailure string

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.

domain str

Verified domain name to generate DKIM tokens for.

mail_from_domain str

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

behavior_on_mx_failure str

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.

Outputs

All input properties are implicitly available as output properties. Additionally, the MailFrom resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing MailFrom Resource

Get an existing MailFrom resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MailFromState, opts?: CustomResourceOptions): MailFrom
static get(resource_name, id, opts=None, behavior_on_mx_failure=None, domain=None, mail_from_domain=None, __props__=None);
func GetMailFrom(ctx *Context, name string, id IDInput, state *MailFromState, opts ...ResourceOption) (*MailFrom, error)
public static MailFrom Get(string name, Input<string> id, MailFromState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

BehaviorOnMxFailure string

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.

Domain string

Verified domain name to generate DKIM tokens for.

MailFromDomain string

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

BehaviorOnMxFailure string

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.

Domain string

Verified domain name to generate DKIM tokens for.

MailFromDomain string

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

behaviorOnMxFailure string

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.

domain string

Verified domain name to generate DKIM tokens for.

mailFromDomain string

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

behavior_on_mx_failure str

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.

domain str

Verified domain name to generate DKIM tokens for.

mail_from_domain str

Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.