Emails with SendGrid
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.
Create a Sendgrid Account
Go to sendgrid.com 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.
Done! Your application is now ready to send emails.
Last updated