1. Packages
  2. Auth0
  3. API Docs
  4. EmailTemplate
Auth0 v2.24.3 published on Wednesday, Sep 20, 2023 by Pulumi

auth0.EmailTemplate

Explore with Pulumi AI

auth0 logo
Auth0 v2.24.3 published on Wednesday, Sep 20, 2023 by Pulumi

    With Auth0, you can have standard welcome, password reset, and account verification email-based workflows built right into Auth0. This resource allows you to configure email templates to customize the look, feel, and sender identities of emails sent by Auth0. Used in conjunction with configured email providers.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        var myEmailProvider = new Auth0.Email("myEmailProvider", new()
        {
            Enabled = true,
            DefaultFromAddress = "accounts@example.com",
            Credentials = new Auth0.Inputs.EmailCredentialsArgs
            {
                AccessKeyId = "AKIAXXXXXXXXXXXXXXXX",
                SecretAccessKey = "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                Region = "us-east-1",
            },
        });
    
        var myEmailTemplate = new Auth0.EmailTemplate("myEmailTemplate", new()
        {
            Template = "welcome_email",
            Body = "<html><body><h1>Welcome!</h1></body></html>",
            From = "welcome@example.com",
            ResultUrl = "https://example.com/welcome",
            Subject = "Welcome",
            Syntax = "liquid",
            UrlLifetimeInSeconds = 3600,
            Enabled = true,
        }, new CustomResourceOptions
        {
            DependsOn = new[]
            {
                myEmailProvider,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myEmailProvider, err := auth0.NewEmail(ctx, "myEmailProvider", &auth0.EmailArgs{
    			Enabled:            pulumi.Bool(true),
    			DefaultFromAddress: pulumi.String("accounts@example.com"),
    			Credentials: &auth0.EmailCredentialsArgs{
    				AccessKeyId:     pulumi.String("AKIAXXXXXXXXXXXXXXXX"),
    				SecretAccessKey: pulumi.String("7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
    				Region:          pulumi.String("us-east-1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewEmailTemplate(ctx, "myEmailTemplate", &auth0.EmailTemplateArgs{
    			Template:             pulumi.String("welcome_email"),
    			Body:                 pulumi.String("<html><body><h1>Welcome!</h1></body></html>"),
    			From:                 pulumi.String("welcome@example.com"),
    			ResultUrl:            pulumi.String("https://example.com/welcome"),
    			Subject:              pulumi.String("Welcome"),
    			Syntax:               pulumi.String("liquid"),
    			UrlLifetimeInSeconds: pulumi.Int(3600),
    			Enabled:              pulumi.Bool(true),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			myEmailProvider,
    		}))
    		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.auth0.Email;
    import com.pulumi.auth0.EmailArgs;
    import com.pulumi.auth0.inputs.EmailCredentialsArgs;
    import com.pulumi.auth0.EmailTemplate;
    import com.pulumi.auth0.EmailTemplateArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 myEmailProvider = new Email("myEmailProvider", EmailArgs.builder()        
                .enabled(true)
                .defaultFromAddress("accounts@example.com")
                .credentials(EmailCredentialsArgs.builder()
                    .accessKeyId("AKIAXXXXXXXXXXXXXXXX")
                    .secretAccessKey("7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
                    .region("us-east-1")
                    .build())
                .build());
    
            var myEmailTemplate = new EmailTemplate("myEmailTemplate", EmailTemplateArgs.builder()        
                .template("welcome_email")
                .body("<html><body><h1>Welcome!</h1></body></html>")
                .from("welcome@example.com")
                .resultUrl("https://example.com/welcome")
                .subject("Welcome")
                .syntax("liquid")
                .urlLifetimeInSeconds(3600)
                .enabled(true)
                .build(), CustomResourceOptions.builder()
                    .dependsOn(myEmailProvider)
                    .build());
    
        }
    }
    
    import pulumi
    import pulumi_auth0 as auth0
    
    my_email_provider = auth0.Email("myEmailProvider",
        enabled=True,
        default_from_address="accounts@example.com",
        credentials=auth0.EmailCredentialsArgs(
            access_key_id="AKIAXXXXXXXXXXXXXXXX",
            secret_access_key="7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            region="us-east-1",
        ))
    my_email_template = auth0.EmailTemplate("myEmailTemplate",
        template="welcome_email",
        body="<html><body><h1>Welcome!</h1></body></html>",
        from_="welcome@example.com",
        result_url="https://example.com/welcome",
        subject="Welcome",
        syntax="liquid",
        url_lifetime_in_seconds=3600,
        enabled=True,
        opts=pulumi.ResourceOptions(depends_on=[my_email_provider]))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const myEmailProvider = new auth0.Email("myEmailProvider", {
        enabled: true,
        defaultFromAddress: "accounts@example.com",
        credentials: {
            accessKeyId: "AKIAXXXXXXXXXXXXXXXX",
            secretAccessKey: "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            region: "us-east-1",
        },
    });
    const myEmailTemplate = new auth0.EmailTemplate("myEmailTemplate", {
        template: "welcome_email",
        body: "<html><body><h1>Welcome!</h1></body></html>",
        from: "welcome@example.com",
        resultUrl: "https://example.com/welcome",
        subject: "Welcome",
        syntax: "liquid",
        urlLifetimeInSeconds: 3600,
        enabled: true,
    }, {
        dependsOn: [myEmailProvider],
    });
    
    resources:
      myEmailProvider:
        type: auth0:Email
        properties:
          enabled: true
          defaultFromAddress: accounts@example.com
          credentials:
            accessKeyId: AKIAXXXXXXXXXXXXXXXX
            secretAccessKey: 7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            region: us-east-1
      myEmailTemplate:
        type: auth0:EmailTemplate
        properties:
          template: welcome_email
          body: <html><body><h1>Welcome!</h1></body></html>
          from: welcome@example.com
          resultUrl: https://example.com/welcome
          subject: Welcome
          syntax: liquid
          urlLifetimeInSeconds: 3600
          enabled: true
        options:
          dependson:
            - ${myEmailProvider}
    

    Create EmailTemplate Resource

    new EmailTemplate(name: string, args: EmailTemplateArgs, opts?: CustomResourceOptions);
    @overload
    def EmailTemplate(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      body: Optional[str] = None,
                      enabled: Optional[bool] = None,
                      from_: Optional[str] = None,
                      include_email_in_redirect: Optional[bool] = None,
                      result_url: Optional[str] = None,
                      subject: Optional[str] = None,
                      syntax: Optional[str] = None,
                      template: Optional[str] = None,
                      url_lifetime_in_seconds: Optional[int] = None)
    @overload
    def EmailTemplate(resource_name: str,
                      args: EmailTemplateArgs,
                      opts: Optional[ResourceOptions] = None)
    func NewEmailTemplate(ctx *Context, name string, args EmailTemplateArgs, opts ...ResourceOption) (*EmailTemplate, error)
    public EmailTemplate(string name, EmailTemplateArgs args, CustomResourceOptions? opts = null)
    public EmailTemplate(String name, EmailTemplateArgs args)
    public EmailTemplate(String name, EmailTemplateArgs args, CustomResourceOptions options)
    
    type: auth0:EmailTemplate
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args EmailTemplateArgs
    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 EmailTemplateArgs
    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 EmailTemplateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EmailTemplateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EmailTemplateArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    EmailTemplate 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 EmailTemplate resource accepts the following input properties:

    Body string

    Body of the email template. You can include common variables.

    Enabled bool

    Indicates whether the template is enabled.

    From string

    Email address to use as the sender. You can include common variables.

    Subject string

    Subject line of the email. You can include common variables.

    Syntax string

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    Template string

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    IncludeEmailInRedirect bool

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    ResultUrl string

    URL to redirect the user to after a successful action. Learn more.

    UrlLifetimeInSeconds int

    Number of seconds during which the link within the email will be valid.

    Body string

    Body of the email template. You can include common variables.

    Enabled bool

    Indicates whether the template is enabled.

    From string

    Email address to use as the sender. You can include common variables.

    Subject string

    Subject line of the email. You can include common variables.

    Syntax string

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    Template string

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    IncludeEmailInRedirect bool

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    ResultUrl string

    URL to redirect the user to after a successful action. Learn more.

    UrlLifetimeInSeconds int

    Number of seconds during which the link within the email will be valid.

    body String

    Body of the email template. You can include common variables.

    enabled Boolean

    Indicates whether the template is enabled.

    from String

    Email address to use as the sender. You can include common variables.

    subject String

    Subject line of the email. You can include common variables.

    syntax String

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template String

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    includeEmailInRedirect Boolean

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    resultUrl String

    URL to redirect the user to after a successful action. Learn more.

    urlLifetimeInSeconds Integer

    Number of seconds during which the link within the email will be valid.

    body string

    Body of the email template. You can include common variables.

    enabled boolean

    Indicates whether the template is enabled.

    from string

    Email address to use as the sender. You can include common variables.

    subject string

    Subject line of the email. You can include common variables.

    syntax string

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template string

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    includeEmailInRedirect boolean

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    resultUrl string

    URL to redirect the user to after a successful action. Learn more.

    urlLifetimeInSeconds number

    Number of seconds during which the link within the email will be valid.

    body str

    Body of the email template. You can include common variables.

    enabled bool

    Indicates whether the template is enabled.

    from_ str

    Email address to use as the sender. You can include common variables.

    subject str

    Subject line of the email. You can include common variables.

    syntax str

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template str

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    include_email_in_redirect bool

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    result_url str

    URL to redirect the user to after a successful action. Learn more.

    url_lifetime_in_seconds int

    Number of seconds during which the link within the email will be valid.

    body String

    Body of the email template. You can include common variables.

    enabled Boolean

    Indicates whether the template is enabled.

    from String

    Email address to use as the sender. You can include common variables.

    subject String

    Subject line of the email. You can include common variables.

    syntax String

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template String

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    includeEmailInRedirect Boolean

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    resultUrl String

    URL to redirect the user to after a successful action. Learn more.

    urlLifetimeInSeconds Number

    Number of seconds during which the link within the email will be valid.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EmailTemplate 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 EmailTemplate Resource

    Get an existing EmailTemplate 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?: EmailTemplateState, opts?: CustomResourceOptions): EmailTemplate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            body: Optional[str] = None,
            enabled: Optional[bool] = None,
            from_: Optional[str] = None,
            include_email_in_redirect: Optional[bool] = None,
            result_url: Optional[str] = None,
            subject: Optional[str] = None,
            syntax: Optional[str] = None,
            template: Optional[str] = None,
            url_lifetime_in_seconds: Optional[int] = None) -> EmailTemplate
    func GetEmailTemplate(ctx *Context, name string, id IDInput, state *EmailTemplateState, opts ...ResourceOption) (*EmailTemplate, error)
    public static EmailTemplate Get(string name, Input<string> id, EmailTemplateState? state, CustomResourceOptions? opts = null)
    public static EmailTemplate get(String name, Output<String> id, EmailTemplateState 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:
    Body string

    Body of the email template. You can include common variables.

    Enabled bool

    Indicates whether the template is enabled.

    From string

    Email address to use as the sender. You can include common variables.

    IncludeEmailInRedirect bool

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    ResultUrl string

    URL to redirect the user to after a successful action. Learn more.

    Subject string

    Subject line of the email. You can include common variables.

    Syntax string

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    Template string

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    UrlLifetimeInSeconds int

    Number of seconds during which the link within the email will be valid.

    Body string

    Body of the email template. You can include common variables.

    Enabled bool

    Indicates whether the template is enabled.

    From string

    Email address to use as the sender. You can include common variables.

    IncludeEmailInRedirect bool

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    ResultUrl string

    URL to redirect the user to after a successful action. Learn more.

    Subject string

    Subject line of the email. You can include common variables.

    Syntax string

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    Template string

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    UrlLifetimeInSeconds int

    Number of seconds during which the link within the email will be valid.

    body String

    Body of the email template. You can include common variables.

    enabled Boolean

    Indicates whether the template is enabled.

    from String

    Email address to use as the sender. You can include common variables.

    includeEmailInRedirect Boolean

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    resultUrl String

    URL to redirect the user to after a successful action. Learn more.

    subject String

    Subject line of the email. You can include common variables.

    syntax String

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template String

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    urlLifetimeInSeconds Integer

    Number of seconds during which the link within the email will be valid.

    body string

    Body of the email template. You can include common variables.

    enabled boolean

    Indicates whether the template is enabled.

    from string

    Email address to use as the sender. You can include common variables.

    includeEmailInRedirect boolean

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    resultUrl string

    URL to redirect the user to after a successful action. Learn more.

    subject string

    Subject line of the email. You can include common variables.

    syntax string

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template string

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    urlLifetimeInSeconds number

    Number of seconds during which the link within the email will be valid.

    body str

    Body of the email template. You can include common variables.

    enabled bool

    Indicates whether the template is enabled.

    from_ str

    Email address to use as the sender. You can include common variables.

    include_email_in_redirect bool

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    result_url str

    URL to redirect the user to after a successful action. Learn more.

    subject str

    Subject line of the email. You can include common variables.

    syntax str

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template str

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    url_lifetime_in_seconds int

    Number of seconds during which the link within the email will be valid.

    body String

    Body of the email template. You can include common variables.

    enabled Boolean

    Indicates whether the template is enabled.

    from String

    Email address to use as the sender. You can include common variables.

    includeEmailInRedirect Boolean

    Whether the reset_email and verify_email templates should include the user's email address as the email parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true.

    resultUrl String

    URL to redirect the user to after a successful action. Learn more.

    subject String

    Subject line of the email. You can include common variables.

    syntax String

    Syntax of the template body. You can use either text or HTML with Liquid syntax.

    template String

    Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, user_invitation, change_password (legacy), or password_reset (legacy).

    urlLifetimeInSeconds Number

    Number of seconds during which the link within the email will be valid.

    Import

    This resource can be imported using the pre-defined template name. # These names are verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, and user_invitation. # The names change_password, and password_reset are also supported for legacy scenarios. # Example

     $ pulumi import auth0:index/emailTemplate:EmailTemplate my_email_template welcome_email
    

    Package Details

    Repository
    Auth0 pulumi/pulumi-auth0
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the auth0 Terraform Provider.

    auth0 logo
    Auth0 v2.24.3 published on Wednesday, Sep 20, 2023 by Pulumi