EmailTemplate

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 Pulumi;
using Auth0 = Pulumi.Auth0;

class MyStack : Stack
{
    public MyStack()
    {
        var myEmailProvider = new Auth0.Email("myEmailProvider", new Auth0.EmailArgs
        {
            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 Auth0.EmailTemplateArgs
        {
            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 = 
            {
                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
	})
}
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],
});

Create a 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,
                  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)
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.

EmailTemplate Resource Properties

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

Inputs

The EmailTemplate resource accepts the following input properties:

Body string
String. Body of the email template. You can include common variables.
Enabled bool
Boolean. Indicates whether or not the template is enabled.
From string
String. Email address to use as the sender. You can include common variables.
Subject string
String. Subject line of the email. You can include common variables.
Syntax string
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
Template string
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
ResultUrl string
String. URL to redirect the user to after a successful action. Learn more.
UrlLifetimeInSeconds int
Integer. Number of seconds during which the link within the email will be valid.
Body string
String. Body of the email template. You can include common variables.
Enabled bool
Boolean. Indicates whether or not the template is enabled.
From string
String. Email address to use as the sender. You can include common variables.
Subject string
String. Subject line of the email. You can include common variables.
Syntax string
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
Template string
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
ResultUrl string
String. URL to redirect the user to after a successful action. Learn more.
UrlLifetimeInSeconds int
Integer. Number of seconds during which the link within the email will be valid.
body string
String. Body of the email template. You can include common variables.
enabled boolean
Boolean. Indicates whether or not the template is enabled.
from string
String. Email address to use as the sender. You can include common variables.
subject string
String. Subject line of the email. You can include common variables.
syntax string
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
template string
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
resultUrl string
String. URL to redirect the user to after a successful action. Learn more.
urlLifetimeInSeconds number
Integer. Number of seconds during which the link within the email will be valid.
body str
String. Body of the email template. You can include common variables.
enabled bool
Boolean. Indicates whether or not the template is enabled.
from_ str
String. Email address to use as the sender. You can include common variables.
subject str
String. Subject line of the email. You can include common variables.
syntax str
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
template str
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
result_url str
String. URL to redirect the user to after a successful action. Learn more.
url_lifetime_in_seconds int
Integer. 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 str
The provider-assigned unique ID for this managed resource.

Look up an 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,
        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)
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:

Body string
String. Body of the email template. You can include common variables.
Enabled bool
Boolean. Indicates whether or not the template is enabled.
From string
String. Email address to use as the sender. You can include common variables.
ResultUrl string
String. URL to redirect the user to after a successful action. Learn more.
Subject string
String. Subject line of the email. You can include common variables.
Syntax string
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
Template string
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
UrlLifetimeInSeconds int
Integer. Number of seconds during which the link within the email will be valid.
Body string
String. Body of the email template. You can include common variables.
Enabled bool
Boolean. Indicates whether or not the template is enabled.
From string
String. Email address to use as the sender. You can include common variables.
ResultUrl string
String. URL to redirect the user to after a successful action. Learn more.
Subject string
String. Subject line of the email. You can include common variables.
Syntax string
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
Template string
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
UrlLifetimeInSeconds int
Integer. Number of seconds during which the link within the email will be valid.
body string
String. Body of the email template. You can include common variables.
enabled boolean
Boolean. Indicates whether or not the template is enabled.
from string
String. Email address to use as the sender. You can include common variables.
resultUrl string
String. URL to redirect the user to after a successful action. Learn more.
subject string
String. Subject line of the email. You can include common variables.
syntax string
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
template string
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
urlLifetimeInSeconds number
Integer. Number of seconds during which the link within the email will be valid.
body str
String. Body of the email template. You can include common variables.
enabled bool
Boolean. Indicates whether or not the template is enabled.
from_ str
String. Email address to use as the sender. You can include common variables.
result_url str
String. URL to redirect the user to after a successful action. Learn more.
subject str
String. Subject line of the email. You can include common variables.
syntax str
String. Syntax of the template body. You can use either text or HTML + Liquid syntax.
template str
String. Template name. Options include verify_email, verify_email_by_code, reset_email, welcome_email, blocked_account, stolen_credentials, enrollment_email, mfa_oob_code, change_password (legacy), and password_reset (legacy).
url_lifetime_in_seconds int
Integer. Number of seconds during which the link within the email will be valid.

Package Details

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