Configuring Email

Instructions for configuring Sendgrid for Garnet

Garnet relies on email messaging for certain features. For example:

  • to send a verification link for a user during the sign up process.

  • to send an invite link for new team members to join Garnet.

  • to send a reset link to a user that has forgotten their password.

Configuring email using Sendgrid (Twilio)

You can configure email using Sendgrid through two provided options:

The domain authentication method allows you to send emails from any address associated with your validated domain. This guarantees email deliverability because it requires you to create DNS records on your specified domain to validate your identity.

  1. For sender authentication, select the option to authenticate a domain. You can configure this directly on https://app.sendgrid.com/settings/sender_auth/domain/create.

  2. Fill out the required details for the domain you want to configure (we recommend using the default config). For advanced configuration, you can set DKIM and SPF records accordingly to ensure email deliverability.

  3. Sendgrid will display a list of DNS records that need to be added to your domain. After adding them in your DNS provider's console, be sure to verify them on Sendgrid.

  4. Done! Sendgrid should now be configured to send emails on behalf of Garnet.

Option 2 - Single sender authentication

Alternatively, you can choose single sender verification which is the easiest option to configure. You will only need to be able to receive emails on the address you want to use as sender. Please note this method is only recommended as starting point for basic usage.

  1. For sender authentication, select the option to create a new sender profile. You can configure this directly on https://app.sendgrid.com/settings/sender_auth/senders/new.

  2. Fill out the required details in the form provided

  3. Validate the email address by clicking on the link provided by Sendgrid.

After you have set up your sender configuration, you can continue below to set up your credentials and configure Garnet to send emails using Sendgrid as a relay.

  • To create the required credentials, go to Settings > API keys and click on "Create API key".

  • Set a name for your API key, we recommend using "Garnet", and select the "Restricted Key" option. You will need to enable the "Mail Send" permission as detailed below. Copy the key directly to your environment configuration.

API Sendgrid
  • Using the key created in the last step, you can now configure the following environment variables for your Garnet instance:

SENDGRID_EMAIL_FROM="your-sender-email"
SENDGRID_KEY="your-sendgrid-key"
SENDGRID_TEMPLATE_EMAIL_ADDRESS_VERIFICATION="verification-template-id"
SENDGRID_TEMPLATE_INVITATION="invitation-template-id"
SENDGRID_TEMPLATE_PASSWORD_RESET="password-reset-template-id"
  • Once you have set the above variables, you can restart your Garnet server and test the email functionality through a workflow, for example, password reset.

Note: you will need to restart both your frontend and backend app for this to work properly.

As an optional step, we recommend turning off 'open & click tracking' in tracking settings to ensure privacy

Email templates

If you wish to configure custom templates for sending email (e.g. email address verification, invitation email, and password reset email), you can do so by creating an email template in SendGrid.

Once you have created the template, pass its template ID (provided by SendGrid) into an environment variable in the Garnet env configuration. For example:

SENDGRID_TEMPLATE_EMAIL_ADDRESS_VERIFICATION="verification-template-id"

You can create a custom email template using the following stub as an example:

Verify your email for Garnet
​
<p>Hello,</p>
<p>Follow this link to verify your email address.</p>
<p><a href="{{link}}">{{link}}</a></p>
<p>
If you didn’t ask to verify this address, you can ignore
this email.
</p>
<p>Thanks,</p>
<p>Team Garnet</p>