// Stay in touch?
Products
Encore CloudEncore Cloud
Encore.tsEncore.ts
Encore.goEncore.go
PricingPricing
Book a DemoBook a Demo
Use Cases
AI-Powered DevelopmentAI-Powered Development
Event-Driven SystemsEvent-Driven Systems
Distributed SystemsDistributed Systems
Case StudiesCase Studies
ShowcaseShowcase
Resources
DocsDocs
InstallInstall
Example AppsExample Apps
Demo videoDemo video
ArticlesArticles
ResourcesResources
GitHub ReleasesGitHub Releases
Systems Operational
Company
About UsAbout Us
Swag ShopSwag Shop
ContactContact
JobsJobs
PressPress
TermsTerms
Privacy PolicyPrivacy Policy
Data Processing AgreementData Processing Agreement
Enterprise SLAEnterprise SLA
Encore
© 2026 EncoreAll rights reserved
© 2026 Encore All Rights Reserved
GitHubDiscordYouTube

See all Templates

SendGrid Integration

Send emails from your app using SendGrid

Tags

Integration

Use Case

Bits

Author

woodroow

Repo

Open on GitHub

Run this template in 60 seconds by installing Encore:

macOS
Windows
Linux
Brew
$ brew install encoredev/tap/encore

SendGrid: Email Delivery

This is an Encore package for asynchronous sending emails via SendGrid using Pub/Sub and the ability to flexibly configure concurrency and retry policies.

Installation

  1. Copy over the sendgrid package directory to your Encore application.
  2. Sync your project dependencies by running go mod tidy.

SendGrid API Key

You will need an API key from SendGrid to use this package. You can get one by signing up for a free account at https://sendgrid.com/.

Once you have the API key, set it as an Encore secret using the name SendGridAPIKey:

# It is good practice to separate API keys for development and production environments $ encore secret set --dev SendGridAPIKey Enter secret value: ***** Successfully updated development secret SendGridAPIKey. # To set the API key for production environment $ encore secret set --prod SendGridAPIKey Enter secret value: ***** Successfully updated development secret SendGridAPIKey.

Please note that emails will only be sent in the production environment to avoid spending your email sending limits.

Endpoints

The sendgrid package contains the following endpoints:

  • sendgrid.Send - Send publishes an email to PubSub for further asynchronous sending using the SendGrid API.

Using the API

curl 'http://localhost:4000/sendgrid' \ -d '{ "from": { "name": "Sender", "email": "[email protected]" }, "to": { "name": "Recipient", "email": "[email protected]" }, "subject": "Sending with Twilio SendGrid is Fun", "text": "and easy to do anywhere, even with Encore", "html": "<strong>and easy to do anywhere, even with Encore</strong>" }'

Learn More

  • Encore Documentation
  • Pub/Sub Documentation
  • SendGrid Documentation