1. Packages
  2. AWS Classic
  3. API Docs
  4. ses
  5. MailFrom

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.27.0 published on Monday, Mar 18, 2024 by Pulumi

aws.ses.MailFrom

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.27.0 published on Monday, Mar 18, 2024 by Pulumi

    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

    Domain Identity MAIL FROM

    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 example = 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", {
        zoneId: exampleAwsRoute53Zone.id,
        name: example.mailFromDomain,
        type: "MX",
        ttl: 600,
        records: ["10 feedback-smtp.us-east-1.amazonses.com"],
    });
    // Example Route53 TXT record for SPF
    const exampleSesDomainMailFromTxt = new aws.route53.Record("example_ses_domain_mail_from_txt", {
        zoneId: exampleAwsRoute53Zone.id,
        name: example.mailFromDomain,
        type: "TXT",
        ttl: 600,
        records: ["v=spf1 include:amazonses.com -all"],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    # Example SES Domain Identity
    example_domain_identity = aws.ses.DomainIdentity("example", domain="example.com")
    example = aws.ses.MailFrom("example",
        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("example_ses_domain_mail_from_mx",
        zone_id=example_aws_route53_zone["id"],
        name=example.mail_from_domain,
        type="MX",
        ttl=600,
        records=["10 feedback-smtp.us-east-1.amazonses.com"])
    # Example Route53 TXT record for SPF
    example_ses_domain_mail_from_txt = aws.route53.Record("example_ses_domain_mail_from_txt",
        zone_id=example_aws_route53_zone["id"],
        name=example.mail_from_domain,
        type="TXT",
        ttl=600,
        records=["v=spf1 include:amazonses.com -all"])
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Example SES Domain Identity
    		exampleDomainIdentity, err := ses.NewDomainIdentity(ctx, "example", &ses.DomainIdentityArgs{
    			Domain: pulumi.String("example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := ses.NewMailFrom(ctx, "example", &ses.MailFromArgs{
    			Domain: exampleDomainIdentity.Domain,
    			MailFromDomain: exampleDomainIdentity.Domain.ApplyT(func(domain string) (string, error) {
    				return fmt.Sprintf("bounce.%v", domain), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		// Example Route53 MX record
    		_, err = route53.NewRecord(ctx, "example_ses_domain_mail_from_mx", &route53.RecordArgs{
    			ZoneId: pulumi.Any(exampleAwsRoute53Zone.Id),
    			Name:   example.MailFromDomain,
    			Type:   pulumi.String("MX"),
    			Ttl:    pulumi.Int(600),
    			Records: pulumi.StringArray{
    				pulumi.String("10 feedback-smtp.us-east-1.amazonses.com"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Example Route53 TXT record for SPF
    		_, err = route53.NewRecord(ctx, "example_ses_domain_mail_from_txt", &route53.RecordArgs{
    			ZoneId: pulumi.Any(exampleAwsRoute53Zone.Id),
    			Name:   example.MailFromDomain,
    			Type:   pulumi.String("TXT"),
    			Ttl:    pulumi.Int(600),
    			Records: pulumi.StringArray{
    				pulumi.String("v=spf1 include:amazonses.com -all"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        // Example SES Domain Identity
        var exampleDomainIdentity = new Aws.Ses.DomainIdentity("example", new()
        {
            Domain = "example.com",
        });
    
        var example = new Aws.Ses.MailFrom("example", new()
        {
            Domain = exampleDomainIdentity.Domain,
            MailFromDomain = exampleDomainIdentity.Domain.Apply(domain => $"bounce.{domain}"),
        });
    
        // Example Route53 MX record
        var exampleSesDomainMailFromMx = new Aws.Route53.Record("example_ses_domain_mail_from_mx", new()
        {
            ZoneId = exampleAwsRoute53Zone.Id,
            Name = example.MailFromDomain,
            Type = "MX",
            Ttl = 600,
            Records = new[]
            {
                "10 feedback-smtp.us-east-1.amazonses.com",
            },
        });
    
        // Example Route53 TXT record for SPF
        var exampleSesDomainMailFromTxt = new Aws.Route53.Record("example_ses_domain_mail_from_txt", new()
        {
            ZoneId = exampleAwsRoute53Zone.Id,
            Name = example.MailFromDomain,
            Type = "TXT",
            Ttl = 600,
            Records = new[]
            {
                "v=spf1 include:amazonses.com -all",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ses.DomainIdentity;
    import com.pulumi.aws.ses.DomainIdentityArgs;
    import com.pulumi.aws.ses.MailFrom;
    import com.pulumi.aws.ses.MailFromArgs;
    import com.pulumi.aws.route53.Record;
    import com.pulumi.aws.route53.RecordArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var exampleDomainIdentity = new DomainIdentity("exampleDomainIdentity", DomainIdentityArgs.builder()        
                .domain("example.com")
                .build());
    
            var example = new MailFrom("example", MailFromArgs.builder()        
                .domain(exampleDomainIdentity.domain())
                .mailFromDomain(exampleDomainIdentity.domain().applyValue(domain -> String.format("bounce.%s", domain)))
                .build());
    
            var exampleSesDomainMailFromMx = new Record("exampleSesDomainMailFromMx", RecordArgs.builder()        
                .zoneId(exampleAwsRoute53Zone.id())
                .name(example.mailFromDomain())
                .type("MX")
                .ttl("600")
                .records("10 feedback-smtp.us-east-1.amazonses.com")
                .build());
    
            var exampleSesDomainMailFromTxt = new Record("exampleSesDomainMailFromTxt", RecordArgs.builder()        
                .zoneId(exampleAwsRoute53Zone.id())
                .name(example.mailFromDomain())
                .type("TXT")
                .ttl("600")
                .records("v=spf1 include:amazonses.com -all")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ses:MailFrom
        properties:
          domain: ${exampleDomainIdentity.domain}
          mailFromDomain: bounce.${exampleDomainIdentity.domain}
      # Example SES Domain Identity
      exampleDomainIdentity:
        type: aws:ses:DomainIdentity
        name: example
        properties:
          domain: example.com
      # Example Route53 MX record
      exampleSesDomainMailFromMx:
        type: aws:route53:Record
        name: example_ses_domain_mail_from_mx
        properties:
          zoneId: ${exampleAwsRoute53Zone.id}
          name: ${example.mailFromDomain}
          type: MX
          ttl: '600'
          records: # Change to the region in which `aws_ses_domain_identity.example` is created
            - 10 feedback-smtp.us-east-1.amazonses.com
      # Example Route53 TXT record for SPF
      exampleSesDomainMailFromTxt:
        type: aws:route53:Record
        name: example_ses_domain_mail_from_txt
        properties:
          zoneId: ${exampleAwsRoute53Zone.id}
          name: ${example.mailFromDomain}
          type: TXT
          ttl: '600'
          records:
            - v=spf1 include:amazonses.com -all
    

    Email Identity MAIL FROM

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    // Example SES Email Identity
    const example = new aws.ses.EmailIdentity("example", {email: "user@example.com"});
    const exampleMailFrom = new aws.ses.MailFrom("example", {
        domain: example.email,
        mailFromDomain: "mail.example.com",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    # Example SES Email Identity
    example = aws.ses.EmailIdentity("example", email="user@example.com")
    example_mail_from = aws.ses.MailFrom("example",
        domain=example.email,
        mail_from_domain="mail.example.com")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ses"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Example SES Email Identity
    		example, err := ses.NewEmailIdentity(ctx, "example", &ses.EmailIdentityArgs{
    			Email: pulumi.String("user@example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ses.NewMailFrom(ctx, "example", &ses.MailFromArgs{
    			Domain:         example.Email,
    			MailFromDomain: pulumi.String("mail.example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        // Example SES Email Identity
        var example = new Aws.Ses.EmailIdentity("example", new()
        {
            Email = "user@example.com",
        });
    
        var exampleMailFrom = new Aws.Ses.MailFrom("example", new()
        {
            Domain = example.Email,
            MailFromDomain = "mail.example.com",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ses.EmailIdentity;
    import com.pulumi.aws.ses.EmailIdentityArgs;
    import com.pulumi.aws.ses.MailFrom;
    import com.pulumi.aws.ses.MailFromArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new EmailIdentity("example", EmailIdentityArgs.builder()        
                .email("user@example.com")
                .build());
    
            var exampleMailFrom = new MailFrom("exampleMailFrom", MailFromArgs.builder()        
                .domain(example.email())
                .mailFromDomain("mail.example.com")
                .build());
    
        }
    }
    
    resources:
      # Example SES Email Identity
      example:
        type: aws:ses:EmailIdentity
        properties:
          email: user@example.com
      exampleMailFrom:
        type: aws:ses:MailFrom
        name: example
        properties:
          domain: ${example.email}
          mailFromDomain: mail.example.com
    

    Create MailFrom Resource

    new MailFrom(name: string, args: MailFromArgs, opts?: CustomResourceOptions);
    @overload
    def MailFrom(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 behavior_on_mx_failure: Optional[str] = None,
                 domain: Optional[str] = None,
                 mail_from_domain: Optional[str] = None)
    @overload
    def MailFrom(resource_name: str,
                 args: MailFromArgs,
                 opts: Optional[ResourceOptions] = None)
    func NewMailFrom(ctx *Context, name string, args MailFromArgs, opts ...ResourceOption) (*MailFrom, error)
    public MailFrom(string name, MailFromArgs args, CustomResourceOptions? opts = null)
    public MailFrom(String name, MailFromArgs args)
    public MailFrom(String name, MailFromArgs args, CustomResourceOptions options)
    
    type: aws:ses:MailFrom
    properties: # The arguments to resource properties.
    options: # 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.
    resource_name str
    The unique name of the resource.
    args MailFromArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control 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.
    name String
    The unique name of the resource.
    args MailFromArgs
    The arguments to resource properties.
    options 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 Architecture and Concepts docs.

    Inputs

    The MailFrom resource accepts the following input properties:

    Domain string
    Verified domain name or email identity to generate DKIM tokens for.
    MailFromDomain string

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

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    MailFromDomain string

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

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    mailFromDomain String

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

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    mailFromDomain string

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

    The following arguments are optional:

    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 or email identity 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)

    The following arguments are optional:

    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 String
    Verified domain name or email identity to generate DKIM tokens for.
    mailFromDomain String

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

    The following arguments are optional:

    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.

    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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up 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
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            behavior_on_mx_failure: Optional[str] = None,
            domain: Optional[str] = None,
            mail_from_domain: Optional[str] = None) -> MailFrom
    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)
    public static MailFrom get(String name, Output<String> id, MailFromState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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 or email identity to generate DKIM tokens for.
    MailFromDomain string

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

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    MailFromDomain string

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

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    mailFromDomain String

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

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    mailFromDomain string

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

    The following arguments are optional:

    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 or email identity 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)

    The following arguments are optional:

    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 or email identity to generate DKIM tokens for.
    mailFromDomain String

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

    The following arguments are optional:

    Import

    Using pulumi import, import MAIL FROM domain using the domain attribute. For example:

    $ pulumi import aws:ses/mailFrom:MailFrom example example.com
    

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.27.0 published on Monday, Mar 18, 2024 by Pulumi