F
Flowman docsWorkflow SDK
Back to app
Workflow step actions

replyToEmail (SMTP)

Source: src/workflows/shared/actions/email.ts. Sends a reply to the email that triggered the workflow, deriving the connector, event, and original email from record.source.

Connector requirements

Configure SMTP settings on the same IMAP connector that receives the email. Replies use that connector's mailbox, preserve threading with the original Message-ID, and store outbound delivery metadata in Convex.

Usage

typescript
import { replyToEmail } from "@/workflows/shared/actions";

await replyToEmail({
  record,
  text: "Thanks for the update. We are reviewing this now.",
  html: "<p>Thanks for the update. We are reviewing this now.</p>",
});

Bound helper

typescript
import { emailActions } from "@/workflows/shared/actions";

const email = emailActions(record);
await email.replyToEmail({
  text: "Approved. We will proceed with the next step.",
});

Smoke test workflow

Use a coding-agent-derived workflow to test the full flow: email trigger source metadata, AI-generated reply content from the original email body, human approval, optional body edits, connector-level reply instructions, and final SMTP reply. Seed it with npx convex run seed:replyToEmailTest, then route an email.received trigger to the workflow. The workflow requires OPENAI_API_KEY in project Environment variables.