# Send Email Integration

Integration actor to send email using apify/send-mail aactor. This integration uses key-value store in order to create the email.

## Actor Statistics

- Total users: 2
- Monthly users: 2
- Runs succeeded: 0.00%
- Categories: Integrations, Automation

## Pricing

$5.00/month + usage

## Input Schema

- **subjectOverride** (type: string): Subject of Email, when empty, data is taken from kv store.
- **textOverride** (type: string): Text body of Email, when empty, data is taken from kv store.
- **subjectKeyOverride** (type: string): Changes the key to the subject stored in KV store.
- **textKeyOverride** (type: string): Changes the key to the text stored in KV store.
- **kvStoreId** (type: string): ID of the KV store containing email data. The KV store should have two keys: 'subject' and 'text' which are used as subject and text of the email respectively.
- **to** (type: string): Email address of the recipient(s), you can comma-separate multiple addresses.
- **cc** (type: string): Email CC same format as to.
- **bcc** (type: string): Email BCC same format as to.
- **replyTo** (type: string): Email address which will be set when recipient will try to reply to mail. Uses header Reply-To <a href= "https://tools.ietf.org/html/rfc5322#section-3.6.2">see doc </a>
- **isMock** (type: boolean): For test purposes - log process to console but not send the e-mail

## API example

## Send Email Integration

- **OpenAPI Version:** `3.1.1`
- **API Version:** `0.0`

Integration actor to send email using apify/send-mail aactor. This integration uses key-value store in order to create the email.

### Servers

- **URL:** `https://api.apify.com/v2`

### Operations

#### Executes an Actor, waits for its completion, and returns Actor's dataset items in response.

- **Method:** `POST`
- **Path:** `/acts/simon.m~send-email-integration/run-sync-get-dataset-items`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`to` (required)**

  `string` — Email address of the recipient(s), you can comma-separate multiple addresses.

- **`bcc`**

  `string` — Email BCC same format as to.

- **`cc`**

  `string` — Email CC same format as to.

- **`isMock`**

  `boolean`, default: `false` — For test purposes - log process to console but not send the e-mail

- **`kvStoreId`**

  `string` — ID of the KV store containing email data. The KV store should have two keys: 'subject' and 'text' which are used as subject and text of the email respectively.

- **`replyTo`**

  `string` — Email address which will be set when recipient will try to reply to mail. Uses header Reply-To \<a href= "https://tools.ietf.org/html/rfc5322#section-3.6.2">see doc \</a>

- **`subjectKeyOverride`**

  `string`, default: `"subject"` — Changes the key to the subject stored in KV store.

- **`subjectOverride`**

  `string` — Subject of Email, when empty, data is taken from kv store.

- **`textKeyOverride`**

  `string`, default: `"text"` — Changes the key to the text stored in KV store.

- **`textOverride`**

  `string` — Text body of Email, when empty, data is taken from kv store.

**Example:**

```
{
  "subjectOverride": "",
  "textOverride": "",
  "subjectKeyOverride": "subject",
  "textKeyOverride": "text",
  "kvStoreId": "",
  "to": "",
  "cc": "",
  "bcc": "",
  "replyTo": "",
  "isMock": false
}
```

##### Responses

###### Status: 200 OK

#### Executes an Actor and returns information about the initiated run in response.

- **Method:** `POST`
- **Path:** `/acts/simon.m~send-email-integration/runs`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`to` (required)**

  `string` — Email address of the recipient(s), you can comma-separate multiple addresses.

- **`bcc`**

  `string` — Email BCC same format as to.

- **`cc`**

  `string` — Email CC same format as to.

- **`isMock`**

  `boolean`, default: `false` — For test purposes - log process to console but not send the e-mail

- **`kvStoreId`**

  `string` — ID of the KV store containing email data. The KV store should have two keys: 'subject' and 'text' which are used as subject and text of the email respectively.

- **`replyTo`**

  `string` — Email address which will be set when recipient will try to reply to mail. Uses header Reply-To \<a href= "https://tools.ietf.org/html/rfc5322#section-3.6.2">see doc \</a>

- **`subjectKeyOverride`**

  `string`, default: `"subject"` — Changes the key to the subject stored in KV store.

- **`subjectOverride`**

  `string` — Subject of Email, when empty, data is taken from kv store.

- **`textKeyOverride`**

  `string`, default: `"text"` — Changes the key to the text stored in KV store.

- **`textOverride`**

  `string` — Text body of Email, when empty, data is taken from kv store.

**Example:**

```
{
  "subjectOverride": "",
  "textOverride": "",
  "subjectKeyOverride": "subject",
  "textKeyOverride": "text",
  "kvStoreId": "",
  "to": "",
  "cc": "",
  "bcc": "",
  "replyTo": "",
  "isMock": false
}
```

##### Responses

###### Status: 200 OK

\####### Content-Type: application/json

- **`data`**

  `object`

  - **`actId`**

    `string`

  - **`buildId`**

    `string`

  - **`buildNumber`**

    `string`

  - **`containerUrl`**

    `string`

  - **`defaultDatasetId`**

    `string`

  - **`defaultKeyValueStoreId`**

    `string`

  - **`defaultRequestQueueId`**

    `string`

  - **`finishedAt`**

    `string`, format: `date-time`

  - **`id`**

    `string`

  - **`meta`**

    `object`

    - **`origin`**

      `string`

    - **`userAgent`**

      `string`

  - **`options`**

    `object`

    - **`build`**

      `string`

    - **`diskMbytes`**

      `integer`

    - **`memoryMbytes`**

      `integer`

    - **`timeoutSecs`**

      `integer`

  - **`startedAt`**

    `string`, format: `date-time`

  - **`stats`**

    `object`

    - **`computeUnits`**

      `integer`

    - **`inputBodyLen`**

      `integer`

    - **`rebootCount`**

      `integer`

    - **`restartCount`**

      `integer`

    - **`resurrectCount`**

      `integer`

  - **`status`**

    `string`

  - **`usage`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `integer`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`usageTotalUsd`**

    `number`

  - **`usageUsd`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `number`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`userId`**

    `string`

**Example:**

```
{
  "data": {
    "id": "",
    "actId": "",
    "userId": "",
    "startedAt": "2025-01-08T00:00:00.000Z",
    "finishedAt": "2025-01-08T00:00:00.000Z",
    "status": "READY",
    "meta": {
      "origin": "API",
      "userAgent": ""
    },
    "stats": {
      "inputBodyLen": 2000,
      "rebootCount": 0,
      "restartCount": 0,
      "resurrectCount": 0,
      "computeUnits": 0
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 1024,
      "diskMbytes": 2048
    },
    "buildId": "",
    "defaultKeyValueStoreId": "",
    "defaultDatasetId": "",
    "defaultRequestQueueId": "",
    "buildNumber": "1.0.0",
    "containerUrl": "",
    "usage": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 1,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    },
    "usageTotalUsd": 0.00005,
    "usageUsd": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 0.00005,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    }
  }
}
```

#### Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.

- **Method:** `POST`
- **Path:** `/acts/simon.m~send-email-integration/run-sync`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`to` (required)**

  `string` — Email address of the recipient(s), you can comma-separate multiple addresses.

- **`bcc`**

  `string` — Email BCC same format as to.

- **`cc`**

  `string` — Email CC same format as to.

- **`isMock`**

  `boolean`, default: `false` — For test purposes - log process to console but not send the e-mail

- **`kvStoreId`**

  `string` — ID of the KV store containing email data. The KV store should have two keys: 'subject' and 'text' which are used as subject and text of the email respectively.

- **`replyTo`**

  `string` — Email address which will be set when recipient will try to reply to mail. Uses header Reply-To \<a href= "https://tools.ietf.org/html/rfc5322#section-3.6.2">see doc \</a>

- **`subjectKeyOverride`**

  `string`, default: `"subject"` — Changes the key to the subject stored in KV store.

- **`subjectOverride`**

  `string` — Subject of Email, when empty, data is taken from kv store.

- **`textKeyOverride`**

  `string`, default: `"text"` — Changes the key to the text stored in KV store.

- **`textOverride`**

  `string` — Text body of Email, when empty, data is taken from kv store.

**Example:**

```
{
  "subjectOverride": "",
  "textOverride": "",
  "subjectKeyOverride": "subject",
  "textKeyOverride": "text",
  "kvStoreId": "",
  "to": "",
  "cc": "",
  "bcc": "",
  "replyTo": "",
  "isMock": false
}
```

##### Responses

###### Status: 200 OK

### Schemas

#### inputSchema

- **Type:**`object`

* **`to` (required)**

  `string` — Email address of the recipient(s), you can comma-separate multiple addresses.

* **`bcc`**

  `string` — Email BCC same format as to.

* **`cc`**

  `string` — Email CC same format as to.

* **`isMock`**

  `boolean`, default: `false` — For test purposes - log process to console but not send the e-mail

* **`kvStoreId`**

  `string` — ID of the KV store containing email data. The KV store should have two keys: 'subject' and 'text' which are used as subject and text of the email respectively.

* **`replyTo`**

  `string` — Email address which will be set when recipient will try to reply to mail. Uses header Reply-To \<a href= "https://tools.ietf.org/html/rfc5322#section-3.6.2">see doc \</a>

* **`subjectKeyOverride`**

  `string`, default: `"subject"` — Changes the key to the subject stored in KV store.

* **`subjectOverride`**

  `string` — Subject of Email, when empty, data is taken from kv store.

* **`textKeyOverride`**

  `string`, default: `"text"` — Changes the key to the text stored in KV store.

* **`textOverride`**

  `string` — Text body of Email, when empty, data is taken from kv store.

**Example:**

```
{
  "subjectOverride": "",
  "textOverride": "",
  "subjectKeyOverride": "subject",
  "textKeyOverride": "text",
  "kvStoreId": "",
  "to": "",
  "cc": "",
  "bcc": "",
  "replyTo": "",
  "isMock": false
}
```

#### runsResponseSchema

- **Type:**`object`

* **`data`**

  `object`

  - **`actId`**

    `string`

  - **`buildId`**

    `string`

  - **`buildNumber`**

    `string`

  - **`containerUrl`**

    `string`

  - **`defaultDatasetId`**

    `string`

  - **`defaultKeyValueStoreId`**

    `string`

  - **`defaultRequestQueueId`**

    `string`

  - **`finishedAt`**

    `string`, format: `date-time`

  - **`id`**

    `string`

  - **`meta`**

    `object`

    - **`origin`**

      `string`

    - **`userAgent`**

      `string`

  - **`options`**

    `object`

    - **`build`**

      `string`

    - **`diskMbytes`**

      `integer`

    - **`memoryMbytes`**

      `integer`

    - **`timeoutSecs`**

      `integer`

  - **`startedAt`**

    `string`, format: `date-time`

  - **`stats`**

    `object`

    - **`computeUnits`**

      `integer`

    - **`inputBodyLen`**

      `integer`

    - **`rebootCount`**

      `integer`

    - **`restartCount`**

      `integer`

    - **`resurrectCount`**

      `integer`

  - **`status`**

    `string`

  - **`usage`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `integer`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`usageTotalUsd`**

    `number`

  - **`usageUsd`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `number`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`userId`**

    `string`

**Example:**

```
{
  "data": {
    "id": "",
    "actId": "",
    "userId": "",
    "startedAt": "2025-01-08T00:00:00.000Z",
    "finishedAt": "2025-01-08T00:00:00.000Z",
    "status": "READY",
    "meta": {
      "origin": "API",
      "userAgent": ""
    },
    "stats": {
      "inputBodyLen": 2000,
      "rebootCount": 0,
      "restartCount": 0,
      "resurrectCount": 0,
      "computeUnits": 0
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 1024,
      "diskMbytes": 2048
    },
    "buildId": "",
    "defaultKeyValueStoreId": "",
    "defaultDatasetId": "",
    "defaultRequestQueueId": "",
    "buildNumber": "1.0.0",
    "containerUrl": "",
    "usage": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 1,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    },
    "usageTotalUsd": 0.00005,
    "usageUsd": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 0.00005,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    }
  }
}
```

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "to": "info@apify.com, hello@apify.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("simon.m/send-email-integration").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "to": "info@apify.com, hello@apify.com" }

# Run the Actor and wait for it to finish
run = client.actor("simon.m/send-email-integration").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "to": "info@apify.com, hello@apify.com"
}' |
apify call simon.m/send-email-integration --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?actors=simon.m/send-email-integration",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## KV Send Mail Actor

This actor is a wrapper around Apify's [send-mail actor](https://apify.com/apify/send-mail) that allows you to send emails using content stored in a Key-Value store.

### Features

- Reads email subject and content from a Key-Value store
- Supports all standard email features (CC, BCC, Reply-To)
- Includes a mock mode for testing
- Simple and easy to use

### Input

The actor accepts the following input parameters:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| kvStoreId | string | No | ID of the KV store containing email data. The store must have two keys: 'subject' and 'text' |
| to | string | Yes | Email address of the recipient(s). Multiple addresses can be comma-separated |
| cc | string | No | CC recipients (comma-separated) |
| bcc | string | No | BCC recipients (comma-separated) |
| replyTo | string | No | Reply-to email address |
| isMock | boolean | No | If true, logs the process but doesn't send the email (for testing) |

### KV Store Requirements

The Key-Value store must contain two keys:

- `subject`: The email subject line
- `text`: The email body content

### Example Input

```json
{
    "kvStoreId": "abc123",
    "to": "recipient@example.com",
    "cc": "cc@example.com",
    "bcc": "bcc@example.com",
    "replyTo": "reply@example.com",
    "isMock": false
}
```

### Usage

1. Create a Key-Value store with your email content or within a integration the default one is used
2. Run the actor with the required parameters
3. The actor will read the content from the KV store and send the email using Apify's send-mail actor

### Notes

- The actor uses Apify's send-mail actor under the hood
- For testing purposes, you can set `isMock` to true to see the email content without actually sending it
- Multiple email addresses in to/cc/bcc fields should be comma-separated
