TXsendgridtwiliohandlebarstransactional

How to use Draftship with SendGrid

Save a Draftship export as a SendGrid Dynamic Template, parameterize it with Handlebars, and trigger sends via the v3 mail send API. Here's the path that bypasses Legacy Templates and respects Outlook fidelity.

HTML import path
code editor
Merge syntax
{{first_name}} (Handlebars)
Image hosting
external
Best for
Engineering teams sending transactional notifications and one-off API-driven campaigns at scale.
Watch out for
Legacy Templates and Dynamic Templates are different. Always use Dynamic.

SendGrid is the default for engineering teams sending transactional email through an API. The product has two template systems: Legacy Templates (deprecated, simple substitution) and Dynamic Templates (Handlebars-powered, conditionals, loops). Use Dynamic for everything new. Legacy still exists for backward compatibility but doesn't support modern features.

Where SendGrid accepts pasted HTML

In the SendGrid dashboard, navigate to Email API → Dynamic Templates. Click Create a Dynamic Template. After naming it, click Add Version → Code Editor. Paste your full Draftship export.

STEP 1Design inDraftshipBlock editorSTEP 2ExportOutlook-safe HTMLCmd+ESTEP 3SendGrid DynamicTemplateEmail API > NewSTEP 4Wire Handlebars{{first_name}}STEP 5Send via v3 API orMarketingtemplate_id +dynamic_dataSendGrid handoff
Draftship to SendGrid Dynamic Template handoff

The version system matters: each Dynamic Template has multiple versions, only one is "active". Iterate by creating new versions, not editing the active one. The version system is your rollback plan.

Handlebars personalization

SendGrid uses Handlebars, which is similar to Liquid but with slightly different syntax for conditionals.

DraftshipSendGrid
{{ first_name }}{{first_name}}
{{ last_name }}{{last_name}}
{{ email }}{{email}}
{{ company }}{{company}}
Default fallback{{#if first_name}}{{first_name}}{{else}}there{{/if}}
Loops{{#each items}}<p>{{this.name}}</p>{{/each}}
Negation{{#unless condition}}...{{/unless}}

Handlebars doesn't have inline default filters like Liquid. The conditional pattern is verbose; consider preprocessing on your side and passing already-defaulted values in the API payload.

Sending via the v3 API

The transactional path uses POST /v3/mail/send with a payload like:

json
{ "personalizations": [{ "to": [{ "email": "user@example.com" }], "dynamic_template_data": { "first_name": "Alex", "company": "Acme" } }], "from": { "email": "noreply@yourdomain.com" }, "template_id": "d-a1b2c3..." }

The d- prefix on template_id distinguishes Dynamic from Legacy. The dynamic_template_data object holds the merge values that resolve Handlebars at send.

Image hosting

SendGrid has no built-in CDN. Use your own CDN (Cloudflare, S3+CloudFront, Bunny). Hardcode absolute URLs in Draftship Image blocks before exporting. SendGrid doesn't auto-host pasted external images.

Marketing Campaigns vs the v3 API

SendGrid splits marketing email into a separate product called Marketing Campaigns. Dynamic Templates work in both, but Marketing Campaigns adds a list-and-segment layer for one-to-many sends. The transactional API is one-to-one only.

If you build the email once in Draftship, you can reuse the template across Marketing Campaigns and the transactional API by referencing the same template_id.

Test send checklist

  • Use Test Data in the template editor with a realistic JSON payload.
  • Trigger a real API send to your own inbox before going live with production traffic.
  • Run the rendered email through the size checker.
  • Verify Sender Authentication (SPF, DKIM, DMARC) is configured for the from-domain.

When to use Marketing Campaigns vs Dynamic Templates directly

Use Marketing Campaigns when you need list management, segmentation, and a UI for non-technical operators. Use Dynamic Templates plus the API when your code drives the send and you only need template rendering. Both reference the same Draftship-built artifact.

For DMARC and authentication setup, see SPF, DKIM, and DMARC explained.

FAQ

Frequently asked questions

What's the difference between SendGrid Legacy and Dynamic Templates?
Legacy uses a simple {{varname}} substitution with no conditionals or loops. Dynamic uses full Handlebars. Legacy is deprecated; new code should always use Dynamic.
Can I version a Dynamic Template?
Yes. Each template can have multiple versions; one is active at a time. Use this for staged rollouts and rollback. Old versions are read-only references.
How do I include a list of items in a transactional email?
Pass the list in dynamic_template_data and use Handlebars {{#each}} in the body. The current iteration is referenced as {{this}}.
Does SendGrid support React Email or MJML?
No, only HTML and Handlebars in the template editor. If you author in MJML or React Email, render to HTML before pasting. Draftship's export is already standard HTML.
Why does my email say 'unauthenticated' in Gmail's headers?
Sender Authentication isn't fully configured. Set up SPF and DKIM under Settings > Sender Authentication, then verify the domain. DMARC alignment requires both to pass.
Try it yourself

Design in Draftship. Paste into SendGrid.