Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Great referral emails drive sharing, build excitement, and deliver clear calls-to-action. SendGrid's dynamic template system lets you design beautiful, reusable email templates that automatically populate with GrowSurf referral data β participant names, referral links, reward details, and leaderboard stats. Well-designed templates save development time and ensure brand consistency.
This guide covers designing SendGrid dynamic templates for each referral email type, implementing Handlebars personalization, creating responsive designs that work on all devices, and organizing templates for easy maintenance as your referral program evolves.
Define the templates you need and the data each one requires.
Build a base template in SendGrid's Design Editor that establishes brand consistency.
Use SendGrid's Handlebars syntax to insert dynamic referral data into your templates.
{{firstName}}, {{referralLink}}, {{referralCode}}{{#if referralCount}}You've referred {{referralCount}} friends!{{else}}Start sharing to earn rewards!{{/if}}{{#greaterThan referralCount 5}}You're a power referrer!{{/greaterThan}}Create the most important template β the one that makes first impressions on new participants.
{{referralLink}}{{referralCode}}Create templates for ongoing referral events that keep participants engaged.
Ensure templates render correctly across email clients and are optimized for engagement.
<!-- SendGrid Dynamic Template: Referral Welcome Email -->
<!-- Template ID: d-welcome123 -->
<!-- Subject: Welcome, {{firstName}}! Your referral link is ready -->
<div style="max-width: 600px; margin: 0 auto; font-family: Arial, sans-serif;">
<!-- Header -->
<div style="background: #4A90D9; padding: 30px; text-align: center;">
<h1 style="color: white; margin: 0;">Welcome to Our Referral Program!</h1>
</div>
<!-- Body -->
<div style="padding: 30px;">
<p>Hey {{firstName}},</p>
<p>Thanks for joining! Share your unique referral link with friends and you'll both earn <strong>{{rewardDescription}}</strong>.</p>
<!-- How it works -->
<h2 style="color: #333;">How It Works</h2>
<ol>
<li><strong>Share</strong> your unique link with friends</li>
<li><strong>Friends sign up</strong> using your link</li>
<li><strong>You both earn</strong> {{rewardDescription}}</li>
</ol>
<!-- CTA Button -->
<div style="text-align: center; margin: 30px 0;">
<a href="{{referralLink}}"
style="background: #4A90D9; color: white; padding: 15px 40px;
text-decoration: none; border-radius: 5px; font-size: 18px;">
Start Sharing Now
</a>
</div>
<!-- Copyable referral link -->
<div style="background: #f5f5f5; padding: 15px; border-radius: 5px; text-align: center;">
<p style="margin: 0 0 5px;">Your referral link:</p>
<code style="font-size: 14px; word-break: break-all;">{{referralLink}}</code>
</div>
{{#if referralCount}}
<!-- Show stats for returning participants -->
<div style="margin-top: 20px; text-align: center;">
<p>Referrals so far: <strong>{{referralCount}}</strong></p>
</div>
{{/if}}
</div>
<!-- Footer -->
<div style="background: #f9f9f9; padding: 20px; text-align: center; font-size: 12px; color: #666;">
<p>Questions? <a href="https://yourcompany.com/support">Contact Support</a></p>
</div>
</div>The referral link CTA button should be visible without scrolling on both desktop and mobile. If a participant opens the email and can immediately see and click the share button, your click-through rates will be significantly higher than if they need to scroll to find it.
Many email clients now support dark mode, which can invert your carefully designed colors. Test your templates in dark mode on Gmail, Apple Mail, and Outlook. Use transparent images, avoid white backgrounds for logos, and test color contrast in both light and dark modes.
Some email clients block images and styled elements. Always include a plain-text version of the referral link below the styled button so participants can still access it even if the email renders poorly. Use a monospace font and a light background to make it stand out.
You can use either. The Design Editor is great for quick, drag-and-drop template creation. For advanced personalization and precise design control, use the Code Editor. Many teams design the base layout in the Design Editor and switch to Code Editor for adding Handlebars logic and fine-tuning responsive behavior.
SendGrid supports multiple versions per template. Create a new version when making changes (Version 2, Version 3, etc.) and set the active version. This gives you rollback capability. For source control, store template HTML in your Git repository and deploy updates via SendGrid's Templates API.
SendGrid doesn't enforce a strict limit on dynamic variables, but the total dynamic_template_data payload should stay under 30KB. For referral emails, you'll typically use 5-15 variables β well within limits. If you need to include large datasets (like a leaderboard table), pass only the top 10 entries.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
