ScaffoldHub - v2
  • Introduction
  • Modeling
    • Two-way Relationships
  • Setup
    • Backend
    • Frontend
    • File Storage
    • Emails with SendGrid
    • Payments with Stripe
  • Debugging
  • Deployment
    • Database
      • SQL
      • MongoDB
    • Backend
      • Google Cloud - App Engine
      • Google Cloud - Run
      • Under construction...
    • Frontend
      • Firebase Hosting
      • Heroku w/ Subdomains
      • Under construction...
  • Features
    • Projects
    • Preview
    • Tenants
      • Single-Tenant
      • Multi-Tenant
      • Multi-Tenant (w/ subdomains)
    • Payments
    • Security
    • Authentication
      • Sign-in and Sign-up
      • Invitation
      • Password Reset
      • Password Change
      • Email Verification
    • Audit Logs
    • Settings
    • Internationalization (I18n)
    • Entity
      • Form
      • Filter and List
      • Export
      • Import
    • API Documentation
  • Architecture
    • Security
    • File Storage
    • Internationalization (I18n)
    • Payments
    • Typescript Support
    • Rate limiting
    • Technologies Versions
    • Under construction...
  • Recipes
    • Testing the API with Postman
    • Enterprise sign-in with WorkOS
    • Under construction...
  • Support
  • Changelog
    • Documentation
    • Scaffolds
  • Custom Development
  • Legacy Scaffolds
  • Go to ScaffoldHub
Powered by GitBook
On this page
  • The backend ENV file
  • Create a Sendgrid Account
  • Create an API key
  • Verify Sender Email
  • Create the email templates

Was this helpful?

  1. Setup

Emails with SendGrid

PreviousFile StorageNextPayments with Stripe

Last updated 4 years ago

Was this helpful?

ScaffoldHub by default uses SendGrid to send emails.

You can override this behavior and use other email providers changing this class implementation: backend/src/services/emailSender.ts.

The backend ENV file

The backend/.env is where we save all the configuration variables for the backend.

As we configure SendGrid, we will set the corresponding variables.

SENDGRID_EMAIL_FROM=""
SENDGRID_KEY=""
SENDGRID_TEMPLATE_EMAIL_ADDRESS_VERIFICATION=""
SENDGRID_TEMPLATE_INVITATION=""
SENDGRID_TEMPLATE_PASSWORD_RESET=""

Create a Sendgrid Account

Go to and create a new account.

Create an API key

Go to Settings > API Keys and create a new API key.

Save this API Key to SENDGRID_KEY.

Make sure your API Key has Mail Send access.

Verify Sender Email

You must verify an email to be used as the sender of the emails.

Verify through Settings > Sender Authentication > Single Sender Verification.

Save this email on SENDGRID_EMAIL_FROM.

Create the email templates

ScaffoldHub sends three types of email:

  • Email Address Verification

  • Invitation

  • Password Reset

Go to Email API > Dynamic Templates and create a new dynamic template.

You will have to create one template for each type of email.

Add the Version of the template using the Code option.

Copy the HTML from the backend/email-templates .

Once ready, the Template and Version will look like this:

Save the Template ID on each corresponding variable.

SENDGRID_TEMPLATE_EMAIL_ADDRESS_VERIFICATION=""
SENDGRID_TEMPLATE_INVITATION=""
SENDGRID_TEMPLATE_PASSWORD_RESET=""

Done! Your application is now ready to send emails.

sendgrid.com