Mails
Email Templates and Customization

Email templates and customization

Before sending any emails, you have to create a new email template and define a unique key in the ROQ Console.

ROQ already provides email templates for user invitation mail, reset password mail, and email confirmation for usage, such as registration confirmation.

Email templates

Add Templates

To create a new email template, go to Transactional MailsTemplates menu.

Create email templates

Click the + Create Mail Template button and then set all these required keys:

  • Key: This is the key used to send email in code.
  • Select Locale: The email locale template.
  • Subject: The email subject.
  • Content: The email content.

Create email template

Editing Templates

To edit a template, click Edit Template button (pen icon) on Controls section of the Templates table.

edit email template

Deleting Templates

To delete an email template, click the Trash button and confirm the deletion.

⚠️

Be careful to delete any email template on ROQ Console. Make sure the email template is not used in any application code because it will make a runtime error if there is a code that sends an email with a nonexistent email template.

Template Content

The email content supports custom variables, which you can set later through code. You can create any text for the email content. You can use placeholders or variables for any custom content you submit.

For instance, using HTML content as a template for a new product with the key product-name and custom variables: recipients_name and product_name:

<!DOCTYPE html>
<html>
<head>
    <title>{{product_name}}</title>
</head>
<body>
    <p>Hello {{recipients_name}},</p>
    
    <p>Exciting news! We've just released {{product_name}}, a managed backend for multi-tenant SaaS applications. It's designed to be easier to use and improve your workflow significantly.</p>
 
    <p>Key features include:</p>
    <ul>
        <li>Authentication</li>
        <li>Roles & Permissions</li>
        <li>Organizations</li>
        <li>Billing & Subscriptions</li>
        <li>Schema builder</li>
    </ul>
 
    <p>Try free and see the difference in your SaaS application development. Visit <a href="https://roq.dev">roq.dev</a> to get started.</p>
 
    <p>Looking forward to your feedback,</p>
    
    <strong>ROQ Team</strong>
</body>
</html>

Later, you can send email using this template with the help of sendMail() API.

What's next?