Email automation lets you send the right message at the right moment without manual intervention. A welcome email when someone signs up, a reminder before an appointment, a follow-up after a purchase: these automated sequences are more timely and consistent than manual sends, and they scale without adding to your workload. SendGrid is an email delivery platform that provides transactional email, marketing campaigns, and an automation API that integrates with most web applications.

This guide covers how to set up SendGrid email automation for reliable delivery. You will learn how to configure your account correctly, send transactional emails through the API, build automated sequences, and handle events through webhooks. The goal is to help you build email sequences that land in the inbox rather than the spam folder.

Why Email Automation Matters for Small Businesses

Manual email sending works when you have a handful of customers, but it breaks down quickly as your business grows. You cannot reliably remember to send a follow-up three days after every enquiry, or to remind every customer the day before their appointment. Email automation solves this by defining the rules once and letting the system execute them consistently.

For UK businesses, reliable email delivery is particularly important. Many small businesses rely on appointment confirmations, booking reminders, and customer follow-ups to keep operations running smoothly. When those emails land in spam, customers arrive unprepared, miss appointments, or feel that communication is unreliable. Setting up automation correctly from the start avoids these problems and reduces the manual workload significantly.

Transactional vs Marketing Email: The Difference

SendGrid distinguishes between two broad categories of email, and understanding the difference affects how you configure your account and how reliably your messages are delivered.

Transactional email consists of individual, triggered messages sent in response to a specific customer action. Order confirmations, password resets, appointment reminders, and shipping notifications are all transactional. These emails are expected by the recipient, so inbox providers treat them more favourably.

Marketing email covers bulk campaigns sent to an entire list: newsletters, promotional offers, product announcements, and seasonal campaigns. These are expected less by recipients and are more likely to be marked as spam if the sending practices are poor.

The distinction matters for deliverability. Sending patterns that are acceptable for transactional email, such as high volume or rapid sending bursts, can trigger spam filters if applied to marketing campaigns. Inbox providers track your sending reputation separately for each category, so mixing the two incorrectly can harm your ability to reach the inbox for both types of message.

SendGrid's API is primarily designed for transactional email. You call the API with the recipient address, template, and dynamic data, and SendGrid delivers the message. Marketing campaigns are managed through the SendGrid Marketing Campaigns interface. Some automated flows sit between the two categories: a welcome sequence is automated like transactional email but sent to a list like marketing email. SendGrid's Automation product handles these in-between flows.

Setting Up SendGrid: API Keys and Sender Authentication

Before you can send a single email, you need to complete two setup steps: creating an API key and authenticating your sending domain. Both are straightforward but essential.

Creating an API Key

Generate an API key from the API Keys section of your SendGrid settings. Give it a descriptive name so you can identify its purpose later, such as production-webapp or booking-system. Copy the key immediately after creation; SendGrid displays it only once.

Store your API key securely. Do not commit it to version control or expose it in client-side code. For production applications, use environment variables or a secrets manager to pass the key to your application.

export SENDGRID_API_KEY="SG.your-api-key-here"

Domain Authentication

Domain authentication proves to inbox providers that you are authorised to send email from your domain. Without it, your messages are likely to be flagged as suspicious and filtered into spam.

The authentication process involves adding DNS records to your domain: an SPF record that authorises SendGrid's servers to send on your behalf, and a DKIM record that provides a cryptographic signature verifying that the email was sent by SendGrid and was not modified in transit. Together with DMARC, these form the email authentication stack.

Note: The SendGrid authentication wizard walks you through the DNS steps. The underlying concepts are the same regardless of which email provider you use, and getting this right significantly improves your chances of reaching the inbox.

Our SPF, DKIM, and DMARC guide covers the email authentication stack in more detail if you want to understand the technical background.

Sending Transactional Email via the API

SendGrid exposes a REST API that accepts POST requests with JSON payloads. Most developers use the official SDK for their language, which handles the HTTP request formatting and response parsing.

Installing the PHP SDK

If you are using PHP, install the SendGrid SDK and an HTTP client using Composer:

composer require sendgrid/sendgrid php-http/curlclient

Sending a Basic Email

The following example demonstrates how to send a simple transactional email using the PHP SDK:

<?php
require 'vendor/autoload.php';

$email = new \SendGrid\Mail\Mail();
$email->setFrom("[email protected]", "Your Business");
$email->addTo("[email protected]");
$email->setSubject("Your appointment is confirmed");
$email->addContent("text/plain", "You have an appointment on Tuesday at 2pm.");
$email->addContent("text/html", "<p>You have an appointment on Tuesday at 2pm.</p>");

$sendgrid = new \SendGrid('your_api_key');
try {
    $response = $sendgrid->send($email);
    echo $response->statusCode(); // 202 Accepted
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
?>

A status code of 202 Accepted indicates that SendGrid accepted the message for delivery. It does not guarantee delivery to the inbox; it means the message passed SendGrid's initial validation and was queued.

Using Dynamic Templates

Hardcoding email content in your application is inflexible. SendGrid's dynamic templates let you define the email structure in the SendGrid UI and populate it with data at send time. This separates design from code and makes it easy to update templates without changing your application.

Create a dynamic template in the SendGrid UI with placeholders using double curly braces: {{name}}, {{appointment_date}}, {{booking_reference}}. Then pass the corresponding values when sending:

$email->setTemplateId("d-abc123def456");
$email->addDynamicTemplateData("name", "Jane Smith");
$email->addDynamicTemplateData("appointment_date", "Tuesday at 2pm");
$email->addDynamicTemplateData("booking_reference", "BK-2024-789");

The template renders these values server-side before SendGrid delivers the final email. This approach is useful for appointment reminders, order confirmations, and any other message where the content varies by recipient.

Automation Flows: Welcome Sequences and Drip Campaigns

SendGrid Automation lets you build triggered email sequences without writing code for each send. These flows run on SendGrid's servers and are triggered when contacts meet specific conditions, such as being added to a list or clicking a link in a previous email.

Welcome Sequences

A welcome sequence is the most fundamental automation for most businesses. When a contact is added to your list, they enter a series of emails sent over days or weeks. A well-designed welcome sequence introduces new subscribers to what you offer, delivers value immediately, and guides them toward their first purchase or booking.

A typical structure for a four-email welcome sequence:

  • Email 1 (immediate): Welcome the subscriber and deliver immediate value, such as a useful resource, a discount code, or access to exclusive content.
  • Email 2 (day 2 or 3): Address common questions or objections. Help the subscriber understand what you do and who you serve.
  • Email 3 (day 5 to 7): Share social proof, such as testimonials, case studies, or customer success stories. Build trust.
  • Email 4 (day 10 to 14): A soft pitch explaining what you offer and who it is best suited for. Include a clear call to action without being pushy.

Space emails 2 through 4 at least 2 to 3 days apart. A sequence that arrives in rapid succession feels aggressive and increases the likelihood of recipients marking it as spam.

Drip Campaigns for Follow-Up

Beyond welcome sequences, automation is useful for ongoing follow-up. Enquiry follow-up, post-purchase sequences, and re-engagement campaigns for inactive contacts can all be automated. Our guide to quote follow-up email sequences covers this pattern in detail, including how to structure timing and content to balance persistence with respect for the recipient's attention.

Our email deliverability guide covers what happens after you send: how to get your automated emails past spam filters and into the inbox. Even the best-written email sequence is worthless if inbox providers are blocking it.

Webhook Integration: Receiving Inbound Events

SendGrid can push events to your application via webhook when something happens to your emails. Configuring a webhook URL in the SendGrid Event Webhook settings tells SendGrid to POST a JSON payload to your endpoint for each event.

Common Event Types

  • delivered: The email was accepted by the recipient's mail server.
  • open: The recipient's email client loaded the email (requires open tracking).
  • click: The recipient clicked a link in the email.
  • bounce: The email could not be delivered. Hard bounces indicate a permanent failure (invalid address); soft bounces indicate a temporary issue.
  • dropped: SendGrid chose not to attempt delivery, often because the address is on your suppression list.
  • spamreport: The recipient marked the email as spam.
  • unsubscribe: The recipient clicked an unsubscribe link.

Example Webhook Payload

{
  "event": "bounce",
  "email": "[email protected]",
  "sg_message_id": "abc123xyz",
  "bounce_classification": "Hard bounce",
  "timestamp": 1709650000
}

What to Do with Webhook Data

Handling webhook events properly is essential for maintaining a healthy sending reputation and providing good customer experience.

Clean your list immediately: When you receive a hard bounce, remove that address from your active list right away. Continuing to send to bounced addresses damages your reputation and can lead to your entire domain being blocked.

Track engagement: Use open and click events to understand which contacts are genuinely interested in your emails. Contacts who never open or click are candidates for re-engagement campaigns or removal from your list.

Handle spam complaints: When a recipient marks your email as spam, this is reported back to SendGrid and to you via webhook. Suppress that address immediately. Sending to addresses that have marked you as spam is one of the fastest ways to destroy your sender reputation.

For appointment-based businesses, webhook data can also feed into your operations: if a confirmation email bounces, flag that appointment for manual follow-up by phone or text. Our SMS reminder guide covers how to reduce no-shows using complementary channels alongside email.

Important Configuration Options

Beyond the basics, several configuration options affect how reliably your emails are delivered and how well your automation performs.

Open and Click Tracking

Enable open tracking to receive webhook events when recipients open your emails. This adds a small invisible image pixel to each email, which loads from SendGrid's servers when the email is opened. Note that some email clients block images by default, so open tracking is not 100% accurate but provides useful aggregate data.

unsubscribe Groups

Marketing emails should include a working unsubscribe link. SendGrid's unsubscribe groups let you categorise your emails so that unsubscribing from one type of email does not unsubscribe the contact from transactional emails like appointment reminders. This is important: legally and practically, you should not stop sending transactional messages just because someone unsubscribes from your newsletter.

IP Address Management

By default, SendGrid sends from shared IP addresses. For high-volume senders, dedicated IP addresses give you more control over your sending reputation, but they also require you to manage IP warming carefully. If you are new to email sending, using SendGrid's shared infrastructure is simpler and usually sufficient.

Common Mistakes to Avoid

Several configuration mistakes commonly cause email delivery problems. Avoiding them from the start saves time and protects your sender reputation.

Skipping domain authentication: Sending from an unauthenticated domain is a quick way to land in spam folders. Complete domain authentication before sending any real email.

Using the same domain for transactional and marketing email: Problems with marketing campaigns can contaminate your transactional sending reputation. Use separate subdomains or send domains for each category.

Ignoring bounce handling: Continuing to send to addresses that have bounced is one of the quickest ways to damage your reputation with inbox providers.

Sending too fast on a new account: If you are using a new SendGrid account or a new dedicated IP, inbox providers will scrutinise your sending patterns. Start with low volumes and increase gradually over several weeks. This is called IP warming, and rushing it leads to blocks.

Taking the Next Step

Setting up SendGrid email automation correctly requires attention to configuration, authentication, and ongoing maintenance. The investment is worthwhile: reliable email delivery means your customers receive appointment confirmations, reminders, and follow-ups, which reduces missed bookings, improves customer experience, and saves you time on manual communication.

If you need help reviewing your current email setup or integrating SendGrid with your existing application, prepare a short note with your current platform, the type of emails you need to send, and any delivery problems you have noticed. That information makes it easier to identify what needs attention first.