# Send Email — UniOne

> Send an email using UniOne. See the documentation

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

## Description

Send an email using UniOne. [See the documentation](https://docs.unione.io/en/web-api-ref#email-send)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `recipients` | `string[]` | No | Array of recipient objects with email, substitutions (merge tags), and metadata. Each recipient can have: email (required), substitutions (object, optional), metadata (object, optional). If provided, this takes precedence over 'To' prop. Example: [{ "email": "recipient@example.com", "substitutions": { "from_name": "John Doe", "subject": "Hello, {name}!" }, "metadata": { "company": "Example Inc." } }]. See the documentation |
| `templateId` | `string` | No | Unique identifier of the template that had been created by template/set method. If Template ID is passed then fields from the template are used instead of missed email/send parameters. Options are loaded from the connected account. |
| `tags` | `string[]` | No | An array of strings (max 4 unique strings, max 50 characters each). You can use tags to categorize emails by your own criteria. Options are loaded from the connected account. |
| `skipUnsubscribe` | `boolean` | No | Whether to skip or not appending default unsubscribe footer. You should ask support to approve. |
| `globalLanguage` | `string` | No | The language of the unsubscribe footer and unsubscribe page. |
| `templateEngine` | `string` | No | The template engine for handling the substitutions(merge tags). |
| `globalSubstitutions` | `object` | No | Object for passing the substitutions(merge tags) common for all recipients - e.g., company name. If the substitution names are duplicated in recipient 'substitutions', the values of the variables will be taken from the recipient 'substitutions'. Example: { "body": { "html": "Hello, {name}!", "plaintext": "Hello, {name}!", "amp": "Hello, {name}!"}, "subject": "Hello, {name}!", "from_name": "John Doe", "options": { "unsubscribe_url": "https://example.com/unsubscribe" } }. |
| `globalMetadata` | `object` | No | Object for passing the metadata common for all the recipients, such as 'key': 'value'. Max key quantity: 10. Max key length: 64 symbols. Max value length: 1024 symbols. |
| `body` | `object` | Yes | Contains HTML/plaintext/AMP parts of the email. Either html or plaintext part is required. Example: { "html": "Hello, {name}!", "plaintext": "Hello, {name}!", "amp": "Hello, {name}!" }. |
| `subject` | `string` | Yes | Email subject |
| `fromEmail` | `string` | No | Sender's email. Required only if Template ID prop is empty. |
| `fromName` | `string` | No | Sender's name |
| `replyTo` | `string` | No | Reply-to email (in case it's different to sender's email) |
| `replyToName` | `string` | No | Reply-To name (if Reply To email is specified and you want to display not only this email but also the name) |
| `trackLinks` | `boolean` | No | If true, click tracking is on (default). If false, click tracking is off. To use track_links = false, you need to ask UniOne support to enable this feature. |
| `trackRead` | `boolean` | No | If true, read tracking is on (default). If false, read tracking is off. To use track_read = false, you need to ask support to enable this feature. |
| `bypassGlobal` | `boolean` | No | If true, the global unavailability list will be ignored. Even if the address was found to be unreachable while sending other UniOne users' emails, or its owner has issued complaints, the message will still be sent. The setting may be ignored for certain addresses. |
| `bypassUnavailable` | `boolean` | No | If true, the current list of unsubscribed addresses for this account or project will be ignored. Works only if Bypass Global is set to true. The setting is available only for users that have been granted the right to omit the unsubscribe link (to request, please contact support). |
| `bypassUnsubscribed` | `boolean` | No | If true, the current list of unsubscribed addresses for this account or project will be ignored. Works only if Bypass Global is set to true. The setting is available only for users that have been granted the right to omit the unsubscribe link. |
| `bypassComplained` | `boolean` | No | If true, the user's or project's complaint list will be ignored. Works only if Bypass Global is set to true. The setting is available only for users that have been granted the right to omit the unsubscribe link. |
| `idempotenceKey` | `string` | No | A string of up to 64 characters containing a unique message key. This can be used to prevent occasional message duplicates. If you send another API request with the same message key within the next minute, it will be declined. We can generate a message key for each letter automatically; to enable this option, please contact our tech support. |
| `headers` | `object` | No | Contains email headers, maximum 50. Only headers with “X-” name prefix are accepted, all other are ignored, for example X-UNIONE-Global-Language, X-UNIONE-Template-Engine. Standard headers “To,” “CC,” and “BCC” are passed without the “X-.” Yet, they are processed in a particular way and, as a result, have a number of restrictions. You can find more details about it here. If our support have approved omitting standard unsubscription block for you, you can also pass List-Unsubscribe, List-Subscribe, List-Help, List-Owner, List-Archive, In-Reply-To and References headers. Example: { "X-UNIONE-Global-Language": "en", "X-UNIONE-Template-Engine": "velocity" }. |
| `sendAt` | `string` | No | Date and time in 'YYYY-MM-DD hh:mm:ss' format in the UTC timezone. Allows schedule sending up to 24 hours in advance. |
| `unsubscribeUrl` | `string` | No | Custom unsubscribe link. Read more here. |

## 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": "unione",
      },
    },
  },
)

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: "unione-send-email",
  arguments: {
    recipients: ["Recipients"],
    templateId: "Template ID",
  },
})
```

**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: "unione-send-email",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    unione: { authProvisionId: "apn_xxxxxxx" },
    recipients: ["Recipients"],
    templateId: "Template ID",
  },
})

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": "unione-send-email",
    "configured_props": {
      "unione": { "authProvisionId": "apn_xxxxxxx" },
      "recipients": ["Recipients"],
      "templateId": "Template ID"
    }
  }'
```

---

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