Last updated

Emails

Emails sent from your app are triggered by specific events and serve as the primary communication method with your customers. The Frontegg portal offers multiple email templates, with several templates enabled by default. When an important event occurs, your application automatically sends the user the appropriate email template.

Frontegg’s email templates cover a range of scenarios triggered by user activities in your app. These templates include actions such as sending recovery codes for account activation/unlock, password resets, tenant invitations, magic link requests, and more.

Email-Templates-1

Customizing email templates

You can customize the content and design of each email template to reflect your branding and message.


Configurations mirroring between environments

Frontegg automatically mirrors email configurations across environments. For example, when switching from development to production, Frontegg carries over the development email configurations to production.

Customizing email templates

To customize email templates, follow these steps:

Step 1: Select email templates

  1. Open the Frontegg portal.
  2. Navigate to [ENVIRONMENT] → Configurations → Authentication → Emails.
  3. The email page lists available templates. Most templates are Active by default, which you can confirm on the right side of the table.
  4. Change the template status by clicking its name and toggling between Active/Inactive.

Email templates in different environments

Manage email templates separately for each environment.


You can enable or disable each email template based on your needs. When an event occurs, your application will send an email using any templates you have enabled for that event.

The table below provides template names, descriptions, and triggering events:

Template NameDescriptionEventAvailable Variables
Reset passwordSent to a user when they reset their password.Password resetname, email, phoneNumber, profilePictureUrl, redirectURL
Activate userSent to a user when they activate their account.Account activationname, email, phoneNumber, profilePictureUrl, redirectURL, roleIds, roleNames, roleKeys, applicationId
Invite to accountSent to a user when invited to join a tenant.Join tenant invitationname, email, phoneNumber, profilePictureUrl, issuer details,roleIds, roleNames, roleKeys, applicationId
Pwned passwordChecks if a user’s password has been exposed in a data breach upon signup or change.Login and signupname, email, phoneNumber, profilePictureUrl, timesPwned
Magic linkSends a magic link for passwordless authentication during login or signup.Login and signupname, email, phoneNumber, profilePictureUrl, redirectURL, expires
Magic codeSends a one-time code for passwordless authentication during login or signup.Login and signupname, email, phoneNumber, profilePictureUrl, code
Connect new deviceNotifies the user when someone logs in from a new device.Login and signupname, email, phoneNumber, profilePictureUrl, metadata attributes
User used invitationSent to the tenant manager when a user accepts an invitation to join the tenant.Tenant invitation acceptedname, email, phoneNumber, profilePictureUrl
MFA EnrollNotification sent when multi-factor authentication (MFA) is enabled on an account.MFA enrollmentname, email
MFA unenrollNotification sent when MFA is disabled on an account.MFA unenrollmentname, email
MFA method addedNotification sent when a new MFA method is added to the account.New MFA method addedname, email
MFA recovery codeSent when a recovery code is used to access an account.MFA recovery code usedname, email
MFA method removedNotification sent when an MFA method is removed from the account.MFA method removedname, email
Email VerificationSent to users signing up with Microsoft Social login, prompting email verification.Login and signupredirectURL
Brute force protectionAlerts the user after multiple login attempts with an incorrect password.Security alertname, email
Suspicious IPSent when login activity is detected from an unfamiliar IP address.Security alertname, email
Account challenge with codeSends a verification code for MFA login challenges.MFA challengename, email, phoneNumber
Impossible travelSent when login activity occurs from distant locations within a short time frame.Security alertname, email
Bot detectionSent when suspicious login activity suggests a potential bot.Security alertname, email
SMS authentication enabledSent when SMS authentication is enabled.SMS authentication enabledname, email
Unlock accountSent to users when they need to unlock their account.Account unlockname, email, phoneNumber, redirectURL
Unlock account successSent when the user successfully unlocks their account.Account unlock successname, email
Activate user with codeSends an activation code to users for account activation.Account activationname, email, phoneNumber, profilePictureUrl, redirectURL, code
Invite to account with codeSends an invitation code to join a tenant.Join tenant invitationname, email, phoneNumber, profilePictureUrl, redirectURL, code

Opting for the default configuration

Leaving email templates in their default setup is completely fine. However, depending on how your application is configured, not all templates may be relevant, and some may need additional setup to function as intended.


Once you enable an email template, you can either use the default content and styles or customize it. See the details below to learn how to adjust the email templates to fit your needs.


Webhooks

Frontegg also provides webhook notifications. Learn more about setting up webhook subscriptions.

Step 2: Customize email templates

Our template forms allow for extensive customization, enabling you to adjust each template’s content and design. For each template, set up the sender address, subject, redirect URL, message content, format, logo, and more. You can also edit the HTML to match your preferred layout.

Email-Templates-2

Form inputs

Each template includes unique form inputs, with some inputs shared across all templates (such as sender address, sender name, subject, and message). Customize each input for every template, with specific inputs varying by template.

Additional inputs in select templates

InputDescription
Redirect URLRoot part: {{LOGIN_URL}}, e.g., {{LOGIN_URL}}/account/reset-password. Replace only the root part with your application URL, but keep the remaining path (/account/reset-password) intact.
Success Redirect URLURL to redirect users to after completing the flow.
MessageHTML content of the email.

Message content

Define the content, layout, and design of each email.

Handlebars

Frontegg email templates use standard handlebars and support the below statements:

  • {{if}} and {{else}}
  • {{#ifEqual}}
  • {{contains}}
  • {{#each}}


Content customization exceptions

Ensure {{name}} and {{redirectURL}} are included in templates that have inputs for these values.

Email variables

Make emails dynamic and personalized by including variables, as shown below:

VariableDescription
{{applicationId}}The ID of the application that a user is being invited to.
{{name}}Email recipient's name (required in HTML templates with redirect URL).
{{email}}Recipient's email address.
{{phoneNumber}}Recipient's phone number.
{{profilePictureUrl}}Recipient's profile picture URL.
{{redirectURL}}Redirect URL as configured.
{{tenantName}}Name of the tenant sending the email.
{{tenant.xxx}}Any attribute on the tenant object with a value.
{{metadata}}Recipient's user metadata.
{{metadata.xxx}}Custom attributes saved on the user's metadata.
{{roleIds}}An array of roleIds that are assigned to the recipient.
{{roleNames}}An array of roleNames that are assigned to the recipient.
{{roleKeys}}An array of roleKeys that are assigned to the recipient.
{{timesPwned}}Number of times the password was found in breaches (for Pwned Password template only).
{{issuerName}}Name of the user who triggered the email.
{{issuerEmail}}Email of the user who triggered the email.
{{issuerMetadata}}Metadata of the user who triggered the email.
{{issuerProfilePictureUrl}}Profile picture URL of the user who triggered the email.

To use a variable, wrap it in double curly braces within your HTML template, e.g., {{name}} or {{tenantName}}.

Layout and design

To set the layout and design of each template, use the HTML Editor.

Email-Templates-3

You can preview and test your changes by selecting the Launch Preview button.

Email-Templates-4

Customized vs. default

All templates are pre-configured, but not every template may be needed. For example, if using passwordless authentication, customizing MagicLink and OTC templates is useful, while ResetPassword may not be necessary.

External providers and limitations

Emails that are being sent from Frontegg's domain use SendGrid, with a limit of 100 emails per day to prevent domain abuse.

To ensure uninterrupted email delivery, you can configure your own email provider. It can be added either via this API or via the UI in the Frontegg portal.