# Send Single Email — Postmark

> Send a single email with Postmark See the documentation

- Key: `postmark-send-single-email`
- Type: Action (Write)
- Version: 0.2.5
- App: Postmark (`postmark`) — https://pipedream.com/apps/postmark.md
- This page (HTML): https://pipedream.com/apps/postmark/actions/send-single-email
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/postmark/actions/send-single-email/send-single-email.mjs

## Description

Send a single email with Postmark [See the documentation](https://postmarkapp.com/developer/api/email-api#send-a-single-email)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `subject` | `string` | Yes | Email subject. |
| `htmlBody` | `string` | No | HTML email message. Required if no Text Body is specified. Required to enable Open Tracking. |
| `textBody` | `string` | No | Plain text email message. Required if no HTML Body is specified. |
| `fromEmail` | `string` | Yes | The sender email address. Must have a registered and confirmed Sender Signature. To include a name, use the format 'Full Name <sender@domain.com>' for the address. |
| `toEmail` | `string` | Yes | Recipient email address. Multiple addresses are comma separated. Max 50. |
| `ccEmail` | `string` | No | Cc recipient email address. Multiple addresses are comma separated. Max 50. |
| `bccEmail` | `string` | No | Bcc recipient email address. Multiple addresses are comma separated. Max 50. |
| `tag` | `string` | No | Email tag that allows you to categorize outgoing emails and get detailed statistics. |
| `replyTo` | `string` | No | Reply To override email address. Defaults to the Reply To set in the sender signature. |
| `customHeaders` | `string[]` | No | List of custom headers to include. |
| `trackOpens` | `boolean` | No | Activate open tracking for this email. Note: the email must have HTML Body to enable open tracking. |
| `trackLinks` | `string` | No | Activate link tracking for links in the HTML or Text bodies of this email. |
| `attachments` | `string[]` | No | Each attachment should be a string with the parameters separated by a pipe character \|, in the format: Name\|Content\|ContentType. Alternatively, you can pass a string representing an object. All three parameters are required: Name - the filename with extension, i.e. readme.txt Content - the base64-encoded string with the binary data for the file, i.e. dGVzdCBjb250ZW50 ContentType - the MIME content type, i.e. text/plain Example with pipe-separated parameters: readme.txt\|dGVzdCBjb250ZW50\|text/plain Example with JSON-stringified object: {"Name":"readme.txt","Content":"dGVzdCBjb250ZW50","ContentType":"text/plain"} |
| `metadata` | `object` | No | Custom metadata key/value pairs. |
| `messageStream` | `string` | No | Set message stream ID that's used for sending. If not provided, message will default to the outbound transactional stream. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "postmark",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "postmark-send-single-email",
  arguments: {
    subject: "Subject",
    htmlBody: "HTML Body",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "postmark-send-single-email",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    postmark: { authProvisionId: "apn_xxxxxxx" },
    subject: "Subject",
    htmlBody: "HTML Body",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "postmark-send-single-email",
    "configured_props": {
      "postmark": { "authProvisionId": "apn_xxxxxxx" },
      "subject": "Subject",
      "htmlBody": "HTML Body"
    }
  }'
```

---

- App: https://pipedream.com/apps/postmark.md · All apps: https://pipedream.com/apps
