Email Block
Send emails with Handlebars template support across multiple providers
Email Block
The Email block sends emails with full Handlebars template support, working seamlessly across Gmail, Outlook, Resend, and SendGrid.
Overview
Use the Email block when you need to:
- Send transactional emails (invoices, receipts, notifications)
- Create dynamic email content with templates
- Attach files to emails
- Schedule emails for later delivery
- Support multiple email providers with a unified interface
Prerequisites
| Provider | Connection Type | Requirements |
|---|---|---|
| Gmail | OAuth via Nango | google-mail provider configured |
| Outlook | OAuth via Nango | microsoft-graph provider configured |
| SendGrid | API Key via Nango | sendgrid provider configured |
| Resend | API Key | RESEND_API_KEY env var or api_key in config |
Configuration
Step Definition
Configuration Fields
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | send, sendTemplate, or schedule |
provider | string | Yes | gmail, outlook, resend, or sendgrid |
to | string/array | Yes | Recipient email address(es) |
subject | string | Yes | Email subject line |
body | object | Yes* | Email content (html and/or text) |
from | string | No | Sender address (provider-dependent) |
cc | array | No | CC recipients |
bcc | array | No | BCC recipients |
reply_to | string | No | Reply-to address |
attachments | array | No | File attachments |
template | object | No | Server-side template config (SendGrid) |
send_at | string | No | Schedule time (ISO 8601) |
Available Actions
send
Send an email immediately.
Output:
sendTemplate
Send using a server-side template (SendGrid only).
Parameters:
| Field | Type | Description |
|---|---|---|
template.id | string | SendGrid dynamic template ID |
template.variables | object | Variables passed to template |
schedule
Schedule an email for later delivery (Resend, SendGrid).
Note: Gmail and Outlook do not support native email scheduling. For these providers, use Trigger.dev scheduled tasks instead.
Handlebars Templates
The Email block uses Handlebars for dynamic content rendering. Templates are processed before sending.
Basic Variables
Conditionals
Loops
Nested Properties
Using Step Outputs
Attachments
Attach files to emails using base64-encoded content.
Attachment Fields:
| Field | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | Name of the attached file |
content | string | Yes | Base64-encoded file content |
content_type | string | No | MIME type (default: application/octet-stream) |
Provider-Specific Features
Gmail
- Uses RFC 2822 message format
- OAuth authentication via
google-mailprovider - Supports threading with
in_reply_toandreferences - No native scheduling support
Outlook
- Uses Microsoft Graph API
- OAuth authentication via
microsoft-graphprovider - Supports priority levels
- No native scheduling support
Priority Values:
1or2= High importance3= Normal importance (default)4or5= Low importance
SendGrid
- Supports server-side dynamic templates
- Native email scheduling
- Open and click tracking
- API key authentication via
sendgridprovider
Resend
- Simple, developer-friendly API
- Native email scheduling
- Direct API calls (no Nango)
- Requires
RESEND_API_KEYenv var orapi_keyin config
Note: Resend does not support server-side templates. Use inline Handlebars templates instead.
Template Variables Reference
| Variable | Description |
|---|---|
{{input.field}} | Workflow trigger input data |
{{steps.stepId.output.field}} | Output from previous step |
{{variables.name}} | Workflow-level variables |
{{env.VAR}} | Environment variables |
{{template_variables.field}} | Step-specific template variables |
Providing Additional Variables
Use template_variables to pass extra data for template rendering:
Error Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
connectionId is required | Missing OAuth connection | Ensure provider connection exists |
Failed to render template | Invalid Handlebars syntax | Check template for syntax errors |
Unsupported email provider | Invalid provider value | Use gmail, outlook, resend, or sendgrid |
template is required | Missing template for sendTemplate | Provide template.id for sendTemplate action |
send_at is required | Missing schedule time | Provide ISO 8601 datetime for schedule action |
Resend API error | Invalid API key or request | Check RESEND_API_KEY and request payload |
Provider-Specific Errors
Gmail:
SendGrid:
Rate Limits
| Provider | Limit | Notes |
|---|---|---|
| Gmail | 100 emails/day (free), 2,000/day (Workspace) | Per user quota |
| Outlook | 30 messages/minute | Per mailbox |
| SendGrid | Varies by plan | 100/day (free), unlimited (paid) |
| Resend | 100/day (free), 50,000/month (Pro) | Based on plan |
Related Blocks
- Slack Block - Send Slack notifications
- Action Steps - Other integration actions
- Transform Steps - Data transformation