SendGrid email integration for web and mobile back ends

Twilio SendGrid is a hosted service for sending transactional and marketing email, through an HTTP API or SMTP. We connect it to your product and set up what keeps email arriving: domain authentication, templates, delivery events and handling of bounces and unsubscribes.
Email
  • Transactional email through the Mail Send API or SMTP
  • Dynamic templates your team can edit outside the code
  • Delivery and engagement events sent to your back end
  • Domain authentication and suppression handling

When SendGrid is the right choice

SendGrid suits products that send both system email and marketing email from one account:

  • You want a hosted service for API-based transactional email as well as marketing sends.
  • Email content must be editable outside the codebase. Dynamic templates use Handlebars, and your code supplies the data for each message.
  • You need delivery and engagement events pushed to your back end through the Event Webhook.
  • You need to receive replies or attachments as HTTP requests. Inbound Parse does that.

When SendGrid is not the right choice

Check these before you commit:

  • Limits and features depend on your plan, so check the plans page. Dedicated IP addresses are documented for the higher plans, and the lower ones use shared pools.
  • You need sending from the European region. That requires an EU subuser and is documented for Pro plans and above.
  • You want to own your sending reputation fully, or stay inside one cloud vendor. A self-run mail server or a cloud-native sender may suit you better; SendGrid's documentation does not compare them.
  • Your sender identity cannot be verified. Sending is restricted by sender verification and compliance checks.

What we build with SendGrid

Typical projects, described in general terms.

Transactional email

Receipts, sign-in links, password resets and notifications sent through the Mail Send API or SMTP.

Templates

Dynamic templates with conditions and loops, so marketing or support can change wording without a release.

Event handling

A webhook that records delivered, bounced, opened and clicked events against your own records.

Domain authentication

SPF, DKIM and DMARC records and branded links, so email is sent as your own domain.

Keys and permissions

Separate API keys with only the permissions each service needs, kept in the environment and not in code.

Suppression handling

Bounces, spam reports and unsubscribes respected in your own system, so you stop sending to addresses that should not receive mail.

What SendGrid gives you

SendGrid's documentation describes sending through the Mail Send API, an HTTP call that returns a success code when a message is accepted, or through SMTP using the user name "apikey" and an API key as the password. Dynamic transactional templates use Handlebars, with substitution, conditions and loops. The Event Webhook reports processing events such as delivered, deferred, dropped, bounce and blocked, and engagement events such as open, click, spam report and unsubscribe. Inbound Parse receives email at a dedicated subdomain and posts the parsed message and attachments to your URL. Suppression lists record bounces, blocks, invalid addresses, spam reports and unsubscribes. API keys carry permission levels, from full access down to custom access.

What an email integration needs beyond the API

  • Domain authentication: enter the root domain, because subdomains do not inherit it. DNS changes can take time to spread, and some DNS hosts append the domain to CNAME values and duplicate it. We check the records before launch.
  • Suppressions: an address that bounced is blocked on later sends, and sends to suppressed addresses still use a credit. We keep your own records in line with SendGrid's.
  • Signed events: the Event Webhook can be signed. We verify the signature on the raw body and deduplicate on each event's ID. SendGrid's event documentation does not cover retries, duplicates or ordering, so we build handlers that are safe against all three.
  • API keys: a key is shown once and cannot be recovered, so we store it in the environment and give each service its own.
  • Rate limits and testing: limits are per endpoint and return a 429 response with headers showing what remains. Sandbox mode validates a request without delivering it.

How we work

  1. Authenticate the domain first: sending, templates and events all depend on it
  2. Build templates with your team: so wording changes do not need a release
  3. Handle events from day one: bounces, unsubscribes and spam reports update your own records
  4. Hand over properly: the DNS records, key scopes and webhook settings documented, with notes on how to read an event

What clients say

Jatinder is one of the most talents programmers I have worked with and the pleasure has been all mine. I look forward to many more projects together.

TheHopeLineWeb development · 2007–09

Related technologies

Technologies that appear alongside SendGrid in our case studies. Select one to see our work with it.

Frequently asked questions

Can we send from our own domain?

Yes. Domain authentication adds DNS records (SPF, DKIM, DMARC and CNAMEs) and removes the "via sendgrid.net" tagline. A sender identity must be verified before sending.

Can we keep using SMTP in an existing app?

Yes. Use smtp.sendgrid.net with the user name "apikey" and an API key that has Mail Send permission as the password.

How do we know whether an email was delivered?

The Event Webhook posts events such as delivered, bounce, dropped, deferred, open and click to your endpoint. You can enable request signing so your server can verify they came from SendGrid.

Can non-developers edit email content?

Dynamic templates use Handlebars and are managed outside the codebase. Your code or SMTP supplies the data for each message.

How can we work together?

There are three ways, on the same terms:

  • Dedicated team, best for ongoing work: interview the developers, then they work on your project full or part time.
  • Fixed scope, best when requirements are clear: we agree the scope and the price up front, and deliver against it.
  • Time and material, best when the scope will change: you pay for the time used and can change priorities as the work goes on.

Whichever you choose, we sign an NDA before work starts, you own the code we write, and every change is reviewed in your repository.

Can I interview the developers before we start?

Yes. For a dedicated team you meet the developers in an online call and interview them before they join your project.

Need email that reliably arrives?

Tell us what you send and to whom. We will say what to set up first and how to handle bounces and unsubscribes.

Tell us about your project

Tell us what you need built, fixed or improved. We come back with questions, a suggested approach and an estimate.