Try AWS Native preview for resources not in the classic version.
aws.ses.MailFrom
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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
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("exampleDomainIdentity", new()
{
Domain = "example.com",
});
var exampleMailFrom = new Aws.Ses.MailFrom("exampleMailFrom", new()
{
Domain = exampleDomainIdentity.Domain,
MailFromDomain = exampleDomainIdentity.Domain.Apply(domain => $"bounce.{domain}"),
});
// Example Route53 MX record
var exampleSesDomainMailFromMx = new Aws.Route53.Record("exampleSesDomainMailFromMx", new()
{
ZoneId = aws_route53_zone.Example.Id,
Name = exampleMailFrom.MailFromDomain,
Type = "MX",
Ttl = 600,
Records = new[]
{
"10 feedback-smtp.us-east-1.amazonses.com",
},
});
// Change to the region in which `aws_ses_domain_identity.example` is created
// Example Route53 TXT record for SPF
var exampleSesDomainMailFromTxt = new Aws.Route53.Record("exampleSesDomainMailFromTxt", new()
{
ZoneId = aws_route53_zone.Example.Id,
Name = exampleMailFrom.MailFromDomain,
Type = "TXT",
Ttl = 600,
Records = new[]
{
"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 {
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("bounce.%v", domain), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
_, err = route53.NewRecord(ctx, "exampleSesDomainMailFromMx", &route53.RecordArgs{
ZoneId: pulumi.Any(aws_route53_zone.Example.Id),
Name: exampleMailFrom.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
}
_, err = route53.NewRecord(ctx, "exampleSesDomainMailFromTxt", &route53.RecordArgs{
ZoneId: pulumi.Any(aws_route53_zone.Example.Id),
Name: exampleMailFrom.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
})
}
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 exampleMailFrom = new MailFrom("exampleMailFrom", MailFromArgs.builder()
.domain(exampleDomainIdentity.domain())
.mailFromDomain(exampleDomainIdentity.domain().applyValue(domain -> String.format("bounce.%s", domain)))
.build());
var exampleSesDomainMailFromMx = new Record("exampleSesDomainMailFromMx", RecordArgs.builder()
.zoneId(aws_route53_zone.example().id())
.name(exampleMailFrom.mailFromDomain())
.type("MX")
.ttl("600")
.records("10 feedback-smtp.us-east-1.amazonses.com")
.build());
var exampleSesDomainMailFromTxt = new Record("exampleSesDomainMailFromTxt", RecordArgs.builder()
.zoneId(aws_route53_zone.example().id())
.name(exampleMailFrom.mailFromDomain())
.type("TXT")
.ttl("600")
.records("v=spf1 include:amazonses.com -all")
.build());
}
}
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",
zone_id=aws_route53_zone["example"]["id"],
name=example_mail_from.mail_from_domain,
type="MX",
ttl=600,
records=["10 feedback-smtp.us-east-1.amazonses.com"])
# Change to the region in which `aws_ses_domain_identity.example` is created
# Example Route53 TXT record for SPF
example_ses_domain_mail_from_txt = aws.route53.Record("exampleSesDomainMailFromTxt",
zone_id=aws_route53_zone["example"]["id"],
name=example_mail_from.mail_from_domain,
type="TXT",
ttl=600,
records=["v=spf1 include:amazonses.com -all"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Example SES Domain Identity
const exampleDomainIdentity = new aws.ses.DomainIdentity("exampleDomainIdentity", {domain: "example.com"});
const exampleMailFrom = new aws.ses.MailFrom("exampleMailFrom", {
domain: exampleDomainIdentity.domain,
mailFromDomain: pulumi.interpolate`bounce.${exampleDomainIdentity.domain}`,
});
// Example Route53 MX record
const exampleSesDomainMailFromMx = new aws.route53.Record("exampleSesDomainMailFromMx", {
zoneId: aws_route53_zone.example.id,
name: exampleMailFrom.mailFromDomain,
type: "MX",
ttl: 600,
records: ["10 feedback-smtp.us-east-1.amazonses.com"],
});
// Change to the region in which `aws_ses_domain_identity.example` is created
// Example Route53 TXT record for SPF
const exampleSesDomainMailFromTxt = new aws.route53.Record("exampleSesDomainMailFromTxt", {
zoneId: aws_route53_zone.example.id,
name: exampleMailFrom.mailFromDomain,
type: "TXT",
ttl: 600,
records: ["v=spf1 include:amazonses.com -all"],
});
resources:
exampleMailFrom:
type: aws:ses:MailFrom
properties:
domain: ${exampleDomainIdentity.domain}
mailFromDomain: bounce.${exampleDomainIdentity.domain}
# Example SES Domain Identity
exampleDomainIdentity:
type: aws:ses:DomainIdentity
properties:
domain: example.com
# Example Route53 MX record
exampleSesDomainMailFromMx:
type: aws:route53:Record
properties:
zoneId: ${aws_route53_zone.example.id}
name: ${exampleMailFrom.mailFromDomain}
type: MX
ttl: '600'
records:
- 10 feedback-smtp.us-east-1.amazonses.com
# Example Route53 TXT record for SPF
exampleSesDomainMailFromTxt:
type: aws:route53:Record
properties:
zoneId: ${aws_route53_zone.example.id}
name: ${exampleMailFrom.mailFromDomain}
type: TXT
ttl: '600'
records:
- v=spf1 include:amazonses.com -all
Email Identity MAIL FROM
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// Example SES Email Identity
var exampleEmailIdentity = new Aws.Ses.EmailIdentity("exampleEmailIdentity", new()
{
Email = "user@example.com",
});
var exampleMailFrom = new Aws.Ses.MailFrom("exampleMailFrom", new()
{
Domain = exampleEmailIdentity.Email,
MailFromDomain = "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 {
exampleEmailIdentity, err := ses.NewEmailIdentity(ctx, "exampleEmailIdentity", &ses.EmailIdentityArgs{
Email: pulumi.String("user@example.com"),
})
if err != nil {
return err
}
_, err = ses.NewMailFrom(ctx, "exampleMailFrom", &ses.MailFromArgs{
Domain: exampleEmailIdentity.Email,
MailFromDomain: pulumi.String("mail.example.com"),
})
if err != nil {
return err
}
return nil
})
}
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 exampleEmailIdentity = new EmailIdentity("exampleEmailIdentity", EmailIdentityArgs.builder()
.email("user@example.com")
.build());
var exampleMailFrom = new MailFrom("exampleMailFrom", MailFromArgs.builder()
.domain(exampleEmailIdentity.email())
.mailFromDomain("mail.example.com")
.build());
}
}
import pulumi
import pulumi_aws as aws
# Example SES Email Identity
example_email_identity = aws.ses.EmailIdentity("exampleEmailIdentity", email="user@example.com")
example_mail_from = aws.ses.MailFrom("exampleMailFrom",
domain=example_email_identity.email,
mail_from_domain="mail.example.com")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Example SES Email Identity
const exampleEmailIdentity = new aws.ses.EmailIdentity("exampleEmailIdentity", {email: "user@example.com"});
const exampleMailFrom = new aws.ses.MailFrom("exampleMailFrom", {
domain: exampleEmailIdentity.email,
mailFromDomain: "mail.example.com",
});
resources:
# Example SES Email Identity
exampleEmailIdentity:
type: aws:ses:EmailIdentity
properties:
email: user@example.com
exampleMailFrom:
type: aws:ses:MailFrom
properties:
domain: ${exampleEmailIdentity.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.
- Mail
From stringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- Behavior
On stringMx Failure 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.
- Mail
From stringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- Behavior
On stringMx Failure 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.
- mail
From StringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior
On StringMx Failure 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.
- mail
From stringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior
On stringMx Failure 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_ strdomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior_
on_ strmx_ failure 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.
- mail
From StringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior
On StringMx Failure 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.
- Behavior
On stringMx Failure 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.
- Mail
From stringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- Behavior
On stringMx Failure 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.
- Mail
From stringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior
On StringMx Failure 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.
- mail
From StringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior
On stringMx Failure 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.
- mail
From stringDomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior_
on_ strmx_ failure 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_ strdomain Subdomain (of above domain) which is to be used as MAIL FROM address (Required for DMARC validation)
The following arguments are optional:
- behavior
On StringMx Failure 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.
- mail
From StringDomain 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.
Try AWS Native preview for resources not in the classic version.