Workflows

Send email from your code, send broadcasts, and build automations with email and push notifications, all next to your product data.

Every send, open, click, and bounce is an event on the person who got it. You see if an email made someone act, and you can watch the session replay of what they did after they clicked.

Send your first email

npx @posthog/wizard email

Your first 10,000 emails each month are free. See pricing.

Get started – free

Three ways to use Workflows

Your code

Send transactional email, such as password resets and receipts, with one call from the PostHog SDK.

Send from code →

Your agent

Ask Claude Code, Codex, or Grok Build to build automations, move you off another provider, and report on results.

Use the MCP →

The PostHog app

Send broadcasts, plan them on a calendar, write emails, and build automations.

Build in the app →

Find your way around the docs

Send email from your code

Send the subject and HTML with one call from the PostHog SDK on your server:

import { PostHog } from "posthog-node"
const posthog = new PostHog("<ph_project_token>", {
host: "https://us.i.posthog.com",
secretKey: process.env.POSTHOG_PROJECT_SECRET_API_KEY,
enableLocalEvaluation: false,
})
await posthog.emails.send({
to: "ada@example.com",
templateKey: "welcome",
subject: "Welcome aboard",
html: "<p>Hi Ada, thanks for signing up.</p>",
distinctId: "user_123",
})

The distinct ID links the email to the person, so its events land next to everything else they did. To let anyone change the email without a deploy, create it in PostHog and send it by template ID instead. You can also send over the API, or render your React Email components. To set up your key, see install the SDK.

Or ask your agent

The PostHog MCP lets Claude Code, Codex, Grok Build, and other agents build and test automations, and report how each one performs. For example:

Ask your agentbuilding-workflows
“Build an onboarding automation that emails new signups who haven't created a dashboard after 2 days.”
“Which of our automations had the most unsubscribes last month, and why?”
“Move my email from Resend to PostHog.”

Your agent saves its changes as drafts. You review each draft and publish it.

Send a broadcast

PostHog looks at what people do in your product and suggests who to email next. Pick an audience, and PostHog AI drafts the email. Then pick a day to send it. See broadcasts.

Suggested audiences for a new broadcast

Plan sends on the calendar

See your broadcasts and scheduled automations on one calendar. When a send would reach the same people too soon after another marketing email, PostHog warns you and suggests a better day. The spacing follows your frequency cap, or 2 days when you have none. See scheduling and the calendar.

The send calendar in PostHog

Write emails

Type / to add a block and {{ to add a person property, then preview the email at desktop, tablet, and phone widths. See the email editor.

The email editor in PostHog

Build automations

An automation starts when someone does something, then waits, branches, and acts. Its steps can:

  • Send an email, a push notification, an SMS, a Slack message, or a webhook, or send to one of PostHog's destinations, such as a CRM.
  • Act in PostHog: capture an event, update person and group properties, or add the person to a cohort.
  • Use AI: watch the person's session recording with Replay Vision, or start an AI task that works in your repositories.

See automations and every step.

With self-driving turned on, PostHog watches how each step performs and suggests changes. Nothing changes until you approve it.

An automation in the PostHog builder

See how each send did

Each broadcast and automation shows its sends, opens, clicks, bounces, and complaints, next to what people did in your product afterward. Each one is an engagement event on the person, so you can use it in insights and funnels like any other event. See metrics.

The metrics for an automation in PostHog

Deliverability

  • No IP address to warm up. Email goes out over shared Amazon SES IP addresses with a good reputation. See deliverability.
  • Transactional email never waits. Password resets and receipts go out at once, even when your daily allowance for other email is used up.
  • Opt-out categories. People can turn off your newsletter and still get their password reset. See opt-outs.
  • Automatic suppression list. A hard bounce blocks all email to the address. A spam complaint blocks marketing email. No automation step can skip this check. See suppression list.
  • Frequency cap. Set how many marketing messages one person can get in a window of days. See frequency cap.

Move from another provider

Connect the PostHog MCP, then ask your agent to move you over. It imports your suppressions, unsubscribes, and templates. Imported automations are drafts, so nothing sends until you turn them on. See move from another provider.

Install the PostHog MCP

npx @posthog/wizard mcp add

Then pick your provider and ask your agent:

“Move our email from Resend to PostHog.”

Still have questions?

Was this page useful?