Email configuration

By default, UI Bakery On-Premise comes with a noop email provider that will only log emails to the backend logs.

SMTP sender

SMTP is the suggested method for sending emails. To enable it, set the following environment variables:

UI_BAKERY_MAILING_PROVIDER=smtp

UI_BAKERY_SMTP_HOST=smtp.mymailhost.com
UI_BAKERY_SMTP_PORT=2525
UI_BAKERY_SMTP_USERNAME=YOUR_SMTP_USERNAME
UI_BAKERY_SMTP_PASSWORD=YOUR_SMTP_PASSWORD
UI_BAKERY_SMTP_ENCRYPTION=tls OR ssl

Restart your containers to apply the settings.

SendGrid sender

SendGrid is another built-in option to send UI Bakery emails.

  1. Create a SendGrid account or use an existing account.

  2. Generate an API Key with the Mail Send access enabled.

  3. Set the following environment variables:

    UI_BAKERY_MAILING_PROVIDER=sendgrid
    
    SENDGRID_API_KEY=YOUR_API_KEY
  4. Restart the containers.

Once configured, your instance will start using your account to send the user invitation, password reset, and other emails.

Configure email sender

By default, all emails are sent from the UI Bakery <admin@uibakery.io> email address. Use the following variables to customize the email sender:

UI_BAKERY_MAILING_EMAIL_FROM=admin@uibakery.io
UI_BAKERY_MAILING_NAME_FROM=UI Bakery

Change email templates

By default, email templates and subjects are provided as environment variables, so you can adjust the emails by modifying their content:

# tells that email will be sent as plain text/html
UI_BAKERY_MAILING_TEMPLATES_MODE=custom

UI_BAKERY_MAILING_WELCOME_TEMPLATE=Hello userName,<br> Welcome to UI Bakery workspace.
UI_BAKERY_MAILING_WELCOME_SUBJECT=Welcome to UI Bakery workspace
# welcome email sender can be customized, if left empty - default sender is used
UI_BAKERY_MAILING_WELCOME_EMAIL_FROM=
UI_BAKERY_MAILING_WELCOME_EMAIL_FROM_NAME=

UI_BAKERY_MAILING_RESET_PASSWORD_TEMPLATE=Hello userName,<br> Here's your <a href="resetPasswordUrl">password reset link</a>.
UI_BAKERY_MAILING_RESET_PASSWORD_SUBJECT=Reset password request

UI_BAKERY_MAILING_CONFIRM_EMAIL_CHANGE_TEMPLATE=Hello userName,<br> Here's a link <a href="changeEmailUrl">to change your email</a>.
UI_BAKERY_MAILING_CONFIRM_EMAIL_CHANGE_SUBJECT=Change email request

UI_BAKERY_MAILING_REQUEST_TO_JOIN_TEMPLATE=Hello,<br> potentialUserEmail requested to join your workspace.
UI_BAKERY_MAILING_REQUEST_TO_JOIN_SUBJECT=User would like to join your organization

UI_BAKERY_MAILING_SHARE_WITH_USER_TEMPLATE=Hello userName,<br> Here's a <a href="organizationUrl">link to access the organizationName workspace</a>.
UI_BAKERY_MAILING_SHARE_WITH_USER_SUBJECT=You are invited to UI Bakery workspace

UI_BAKERY_MAILING_AUTOMATION_ERROR_TEMPLATE=Hello,<br> Automation workflowName failed, error:<br> errorMessage
UI_BAKERY_MAILING_AUTOMATION_ERROR_SUBJECT=UI Bakery automation workflowName failed

You can use the following built-in email variables to add user values to your emails:

# All emails
userName, userEmail, subject, userId

# Reset password request
resetPasswordUrl

# Invitation email
organizationUrl, organizationName

# Request to join email
potentialUserEmail

# Change email request
changeEmailUrl

# Automation error
workflowName, errorMessage

If you are using SendGrid as an email sender, you can set up email templates using SendGrid dynamic templates and put template IDs instead of plain HTML emails:

# tells that email will be sent using dynamic templates
UI_BAKERY_MAILING_TEMPLATES_MODE=provided

UI_BAKERY_MAILING_WELCOME_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_RESET_PASSWORD_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_CONFIRM_EMAIL_CHANGE_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_SHARE_WITH_USER_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_REQUEST_TO_JOIN_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx
UI_BAKERY_MAILING_AUTOMATION_ERROR_TEMPLATE=d-c3f84d76543941c084ff2de0exxxxxxx

Ensure you provide template IDs for all available emails. Emails without a provided ID will fail to be sent.

Note, that in this case an email subject will be taken from a dynamic template configuration, and variables such as UI_BAKERY_MAILING_WELCOME_SUBJECTare ignored.

This way, you don't need to manage template content inside your environment variables and can build more advanced emails with images and custom styles.

Last updated