# Dataset to Email — CSV, XLSX, JSON via your SMTP or API (`teal_blacksmith/dataset-to-email`) Actor

Emails any Apify dataset as CSV, XLSX or JSON attachments with an HTML preview table, through your own SMTP server (Gmail or any host) or Resend, SendGrid, Mailgun, Postmark or Brevo. Works as an integration. $0.005 per email sent; dry runs and failures are free.

- **URL**: https://apify.com/teal_blacksmith/dataset-to-email.md
- **Developed by:** [도영 김](https://apify.com/teal_blacksmith) (community)
- **Categories:** Integrations, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 email sents

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does Dataset to Email do?

It emails the results of an Actor run. The dataset is attached as **CSV, XLSX or JSON** (any combination), and the email body carries a short summary and an HTML **preview table** of the first rows.

The email is sent through **your own SMTP server or email API account** — Gmail, any SMTP host, Resend, SendGrid, Mailgun, Postmark or Brevo. It leaves from your address, with your domain's reputation, to any recipient your provider allows.

- **Works as an integration.** Attach it to any Actor or task and every finished run is emailed. No base64, no code.
- **Attachments are built for you.** CSV is UTF-8 with BOM and RFC 4180 quoting, so it opens correctly in Excel. XLSX keeps numbers as numbers. Nested data is flattened to `a.b.c` columns.
- **Safe to open.** Values that look like formulas (`=`, `+`, `-`, `@`) cannot run: CSV cells get a leading `'`, XLSX cells are written as text.
- **Large results do not fail the run.** Above the size limit the attachments are left out and download links to the dataset are put in the body instead.
- **Try before you send.** `dryRun` renders the email into the key-value store without sending anything and without any credentials.
- **Honest results.** Every run writes one row with a status, machine-readable reason codes and whether it was charged.

This Actor is for **reports and alerts**. It must not be used for bulk, promotional or unsolicited email: one run sends one email to at most **20 recipients** (`to` + `cc` + `bcc`).

### How much does it cost?

**$0.005 per email sent** (pay per event, event `email-sent`). Apify may add its own small Actor-start event; the run's cost breakdown shows it.

You are charged only when your provider accepts the email (status `sent`) — once per run, whatever the number of recipients, rows or attachments.

| Status | Charged |
|---|---|
| `sent` | $0.005 |
| `dry_run` | free |
| `skipped_empty` | free |
| `failed` | free |

Your SMTP or email API provider may bill you separately under its own plan. If you set a maximum cost per run and it does not cover one email, nothing is sent (reason `BUDGET_EXCEEDED`).

### Use it as an integration

1. Open the Actor or task whose results you want by email.
2. Go to **Integrations**, choose to connect another Actor, and pick **Dataset to Email**.
3. Choose when it runs (for example *Run succeeded*).
4. Fill in `to`, `from` and the provider settings. **Turn `dryRun` off.** Set `datasetId` to `{{resource.defaultDatasetId}}` (switch the input to JSON view if the dataset picker does not accept a variable). This Actor runs with limited permissions, and a dataset passed through the `datasetId` field is the only one it is allowed to read — without it the run fails with `DATASET_READ_FAILED`. Remove the example `rows`.

`{{actorName}}`, `{{runId}}` and `{{runStatus}}` are filled from the run that triggered the integration, so one setup can report failures too: trigger on *Run failed* and the default subject starts with `[FAILED]`.

You can also run it directly with a `datasetId`, on a schedule, from the API, or from an AI agent with `rows`.

### Provider setup

Pick a provider in **Send with** and fill only its fields.

| Provider | `provider` | What to enter | Notes |
|---|---|---|---|
| Gmail / Google Workspace | `smtp` | `smtpHost` `smtp.gmail.com`, `smtpPort` `587`, `smtpUser` your address, `smtpPassword` an **app password** | Needs 2-Step Verification; create the app password in your Google Account. Your normal password is rejected. `from` must be the account address or one of its aliases. |
| Any SMTP server | `smtp` | `smtpHost`, `smtpPort` (`587`, `465`, `2525` or `25`), `smtpUser`, `smtpPassword` | `465` uses implicit TLS; the other ports use STARTTLS, which is required. |
| Resend | `resend` | `apiKey` | `from` must be on a domain verified in Resend. |
| SendGrid | `sendgrid` | `apiKey` (Mail Send permission) | `from` must be a verified sender or on an authenticated domain. |
| Mailgun | `mailgun` | `apiKey`, `mailgunDomain`, `mailgunRegion` (`us` or `eu`) | Use the region your domain was created in. |
| Postmark | `postmark` | `apiKey` = the **server token** | `from` must be a confirmed sender signature or domain. |
| Brevo | `brevo` | `apiKey` | `from` must be a validated sender. |

Passwords and API keys are secret inputs: Apify stores them encrypted, and this Actor never writes them to the log, the output or error messages.

### Input

| Field | Default | Meaning |
|---|---|---|
| `to` | required | Recipient addresses. At most 20 across `to`, `cc`, `bcc`. `Name <a@b.com>` is accepted. |
| `from` | required | A sender address you own. `Name <a@b.com>` is accepted. |
| `cc`, `bcc`, `replyTo` | none | Optional. Duplicates across `to`, `cc`, `bcc` are sent once. |
| `dryRun` | `false` | Render only: nothing is sent, no provider settings needed. See [Dry run](#dry-run). |
| `datasetId` | none | Dataset to send. In an integration use `{{resource.defaultDatasetId}}`. |
| `rows` | none | A JSON array of objects to send instead of a dataset. |
| `fields` | all | Columns to include, in this order. A parent name (`details`) includes every column under it. |
| `omitFields` | none | Columns to exclude. |
| `maxRows` | `10000` | Rows to read, 1 to 100,000. More rows are cut off and reported. |
| `skipIfEmpty` | `false` | `false`: 0 rows sends a "no results" email. `true`: nothing is sent, status `skipped_empty`. |
| `subject`, `text`, `html` | generated | Leave all empty for the default subject and body. Give only `text` or only `html` to send only that part. |
| `previewRows` | `20` | Rows in the preview table, 0 to 100. `0` removes the table. The table shows at most 8 columns. |
| `attachmentFormats` | `["csv"]` | Any of `csv`, `xlsx`, `json`. `[]` sends no attachment. |
| `maxAttachmentMb` | `10` | Total attachment size limit, 1 to 20 MB. See [Limits](#limits). |
| `provider` | `smtp` | `smtp`, `resend`, `sendgrid`, `mailgun`, `postmark` or `brevo`. |
| `smtpHost`, `smtpPort`, `smtpSecure`, `smtpUser`, `smtpPassword` | port `587` | SMTP only. |
| `apiKey` | none | API providers only. |
| `mailgunDomain`, `mailgunRegion` | region `us` | Mailgun only. |

The data source is the first of: `datasetId`, the integration payload, `rows`.

#### Placeholders

Usable in `subject`, `text` and `html`. In `html` the values are HTML-escaped.

| Placeholder | Value |
|---|---|
| `{{itemCount}}` | Number of rows sent |
| `{{datasetId}}` | Dataset ID (empty with `rows`) |
| `{{actorName}}` | Title of the Actor that produced the dataset (empty if unknown) |
| `{{runId}}` | Run that produced the dataset |
| `{{runStatus}}` | Status of the triggering run, for example `SUCCEEDED` (integration only) |
| `{{date}}` | Date of this run, `YYYY-MM-DD`, UTC |
| `{{datasetUrl}}` | API link to the dataset items (`text` and `html` only) |
| `{{previewTable}}` | The preview table (`text` and `html` only) |

#### Dry run

With `dryRun: true` nothing is sent and nothing is charged. The run saves:

- `EMAIL_PREVIEW` — JSON with the subject, text body, HTML body, attachment names and sizes.
- `EMAIL_PREVIEW.html` — the HTML body, which you can open in a browser.

The prefilled input is a dry run with two example rows, so the first run of this Actor succeeds without any setup.

### Output

One dataset item per run, also stored as the `OUTPUT` record:

```json
{
  "status": "sent",
  "provider": "smtp",
  "messageId": "<b1f5c0c2-7d1e-4f1e-9c57-0a2a7a7e6f01@yourdomain.com>",
  "recipientCount": 3,
  "rejectedRecipientCount": 0,
  "itemCount": 1250,
  "source": "integration",
  "datasetId": "aBcDeFgHiJkLmNoPq",
  "attachments": [
    { "filename": "shop-scraper-2026-11-12.csv", "format": "csv", "bytes": 184220 },
    { "filename": "shop-scraper-2026-11-12.xlsx", "format": "xlsx", "bytes": 96412 }
  ],
  "attachmentBytes": 280632,
  "reasons": [],
  "message": "Email accepted by smtp for 3 of 3 recipient(s), 1250 row(s), 2 attachment(s).",
  "providerMessage": null,
  "attempts": 1,
  "previewKey": null,
  "durationMs": 2140,
  "charged": true
}
```

Recipient and sender addresses are never written to the output or the log — only their count. `providerMessage` is the provider's own error text with addresses and secrets removed.

#### Status

| Status | Meaning | Run ends as |
|---|---|---|
| `sent` | The provider accepted the email. | Succeeded |
| `dry_run` | Rendered and saved, not sent. | Succeeded |
| `skipped_empty` | 0 rows and `skipIfEmpty` is on. Not sent. | Succeeded |
| `failed` | Not sent. `reasons` says why. | Failed |

A `failed` run still writes its result row first, then ends as **Failed** so integrations, schedules and monitoring notice it.

#### Reason codes

Informational (the run did not fail because of them):

| Code | Meaning |
|---|---|
| `EMPTY_DATASET` | The source had 0 rows. |
| `ROWS_TRUNCATED_AT_MAX_ROWS` | The source had more rows than `maxRows`; only the first `maxRows` were sent. |
| `ATTACHMENT_TOO_LARGE_LINKED` | Attachments exceeded `maxAttachmentMb`; they were left out and dataset download links were added to the body. |
| `ATTACHMENT_TOO_LARGE_OMITTED` | Attachments exceeded `maxAttachmentMb` and were left out; no link could be added (data came from `rows`, or `fields`/`omitFields` use nested names that a link cannot reproduce). |
| `XLSX_CELLS_TRUNCATED` | A cell was longer than Excel's 32,767-character limit and was cut in the XLSX file. |
| `SOME_RECIPIENTS_REJECTED` | SMTP only: the server accepted the email for some recipients and rejected others. See `rejectedRecipientCount`. |
| `ROWS_IGNORED_FOR_INTEGRATION` | The run was triggered by an integration, so the dataset of the triggering run was used and `rows` was ignored. |
| `CHARGE_FAILED` | The email was sent but the charge could not be recorded; `charged` is `false`. |

Failures (status `failed`, nothing charged):

| Code | Meaning | Retried |
|---|---|---|
| `INVALID_INPUT` | A field is missing or malformed. `message` names the field. | no |
| `UNSAFE_SMTP_HOST` | `smtpHost` is, or resolves to, a private, loopback, link-local or internal address. | no |
| `DATASET_NOT_FOUND` | No dataset with that ID. | no |
| `DATASET_READ_FAILED` | The dataset could not be opened or read. | no |
| `BUDGET_EXCEEDED` | The run's maximum cost does not cover one email. | no |
| `RUN_RESTARTED_NOT_RESENT` | The run was restarted after it began sending. It was not sent again, to avoid a duplicate. | no |
| `AUTH_FAILED` | The provider rejected the user name, password or API key. | no |
| `PERMISSION_DENIED` | The key is valid but may not send this email (unverified sender or domain, restricted key, test-only account). | no |
| `SENDER_REJECTED` | SMTP: the server rejected the `from` address. | no |
| `RECIPIENT_REJECTED` | The provider rejected the recipients. | no |
| `REQUEST_REJECTED` | The provider rejected the request as invalid (HTTP 4xx other than the codes above, typically 400, 404 or 422). | no |
| `MESSAGE_TOO_LARGE` | The provider rejected the email as too large. | no |
| `CONNECTION_FAILED` | The server or API could not be reached, or TLS could not be established. | yes, except DNS and TLS failures |
| `RATE_LIMITED` | The provider's rate limit was hit (HTTP 429). | yes |
| `PROVIDER_ERROR` | The provider failed (HTTP 5xx, or an SMTP error not covered above). | yes, except permanent SMTP errors (5xx) |
| `UNEXPECTED_ERROR` | Anything else. | no |

Retried failures are tried again at most 2 times (3 attempts in total), honouring `Retry-After` up to 30 seconds. Authentication and recipient failures are never retried.

### Attachments

- **CSV** — UTF-8 with BOM, comma-separated, CRLF line ends, RFC 4180 quoting. Text that starts with `=`, `+`, `-`, `@`, tab or carriage return gets a leading `'` so spreadsheet programs do not run it as a formula (plain numbers such as `-12.5` are left alone). You will see that `'` in the cell.
- **XLSX** — one sheet named `Data`, bold frozen header row. Numbers and booleans keep their type; all text is stored as text, so formula-like values are shown, not run. Cells longer than 32,767 characters are cut.
- **JSON** — the original items, untouched. If you set `fields` or `omitFields`, it holds the same flattened columns as the CSV instead.
- Nested objects become dot-notation columns (`details.color`). Lists of text or numbers are joined with `, `. Lists of objects become JSON text.
- Files are named after the source Actor and the date, for example `shop-scraper-2026-11-12.csv` (`dataset-2026-11-12.csv` when the Actor is unknown).
- With 0 rows no file is attached.

### Limits

- **20 recipients per run** across `to`, `cc` and `bcc`. One run sends one email. Not for bulk, promotional or unsolicited email — use it for reports and alerts to people who expect them.
- **Rows:** `maxRows` defaults to 10,000 and can be raised to 100,000.
- **Attachment size:** `maxAttachmentMb` defaults to 10 MB and can be raised to 20 MB (total of all files, before email encoding, which adds about a third). Your provider may allow less; Gmail, for example, limits a message to 25 MB. Above the limit the attachments are replaced by download links.
- **Download links** point to the Apify dataset API. They work for anyone who has the link unless your account restricts access to storages, and they stop working when the dataset expires under your data-retention setting.
- **SMTP:** only ports 25, 465, 587 and 2525; TLS is required (implicit on 465, STARTTLS elsewhere); servers on private, loopback, link-local or internal addresses are refused.
- **Preview table:** at most 100 rows and 8 columns, 120 characters per cell. The attachments hold everything.
- **Delivery is your provider's job.** `sent` means the provider accepted the email. Bounces, spam filtering and delivery reports stay in your provider's dashboard.
- **A retry after a timeout can, rarely, deliver twice** if the first attempt was accepted but its answer was lost. Resend requests carry an idempotency key to prevent this.
- Email addresses with non-ASCII domain names are not accepted; use the punycode form.

### How is this different from `apify/send-mail`?

[`apify/send-mail`](https://apify.com/apify/send-mail) is Apify's own free Actor for sending a notification email. According to its README (read on 2026-11-12):

| | `apify/send-mail` | Dataset to Email |
|---|---|---|
| Sender | Its input has no sender field | Your own address, through your SMTP or email API account |
| Recipients on the Apify free plan | Only the email address of your own Apify account | Any address your provider accepts, up to 20 per run |
| Recipients on paid plans | Up to 20 | Up to 20 per run |
| Dataset as attachment | You supply each attachment yourself as a base64 string | Built from the dataset: CSV, XLSX, JSON |
| Body | The text or HTML you supply | Default summary and preview table, or your own text and HTML with placeholders |
| Price | Free (you pay platform usage) | $0.005 per email sent |

If you only need a plain notification to your own address, `apify/send-mail` does that for free.

### For agents and MCP clients

Minimal input to send a small table:

```json
{
  "to": ["team@example.com"],
  "from": "Reports <reports@yourdomain.com>",
  "rows": [{ "name": "Ann", "score": 9 }],
  "provider": "resend",
  "apiKey": "<key>"
}
```

Read the result from the `OUTPUT` record or the single dataset item: check `status`, then `reasons`. Add `"dryRun": true` to check the rendering first; no key is needed for that.

### License

MIT

# Actor input Schema

## `to` (type: `array`):

Recipient email addresses. "to", "cc" and "bcc" together allow at most 20 addresses per run. This Actor is for reports and alerts, not for bulk or marketing email.

## `from` (type: `string`):

A sender address you own and that your SMTP account or email API is allowed to send as. A display name is allowed: Reports <reports@yourdomain.com>.

## `cc` (type: `array`):

Optional copy recipients.

## `bcc` (type: `array`):

Optional hidden copy recipients.

## `replyTo` (type: `string`):

Optional address that replies should go to.

## `dryRun` (type: `boolean`):

When on, nothing is sent and no provider settings are needed. The rendered email (subject, HTML body, attachment names and sizes) is saved to the key-value store record EMAIL_PREVIEW, and the HTML body to EMAIL_PREVIEW.html. Turn it off to send.

## `datasetId` (type: `string`):

Apify dataset to send. When this Actor is attached as an integration to another Actor, set this to {{resource.defaultDatasetId}} (the dataset of the run that triggered it). Leave empty when you pass Rows.

## `rows` (type: `array`):

A JSON array of objects to send instead of a dataset, for example \[{"name": "Ann", "age": 30}]. Handy for AI agents and small reports. Ignored when the Actor runs as an integration.

## `fields` (type: `array`):

Column names to include, in this order. Nested data uses dot notation (details.color); a parent name (details) includes all columns under it. Leave empty for all columns in first-seen order.

## `omitFields` (type: `array`):

Column names to exclude. A parent name (details) excludes all columns under it.

## `maxRows` (type: `integer`):

Read at most this many rows. When the source has more, the email says so and the result has the reason ROWS_TRUNCATED_AT_MAX_ROWS.

## `skipIfEmpty` (type: `boolean`):

Off: a "no results" email is sent when the source has 0 rows. On: nothing is sent and the status is skipped_empty.

## `subject` (type: `string`):

Leave empty for a default subject. Placeholders: {{itemCount}}, {{datasetId}}, {{actorName}}, {{runId}}, {{runStatus}}, {{date}}.

## `text` (type: `string`):

Optional plain-text body. Placeholders as in Subject, plus {{datasetUrl}} and {{previewTable}}.

## `html` (type: `string`):

Optional HTML body. Placeholders as in Subject, plus {{datasetUrl}} and {{previewTable}} (the preview table as HTML). Placeholder values are HTML-escaped.

## `previewRows` (type: `integer`):

Number of rows in the preview table. 0 removes the table.

## `attachmentFormats` (type: `array`):

Any of csv, xlsx, json. An empty list sends no attachment. CSV is UTF-8 with BOM and opens correctly in Excel.

## `maxAttachmentMb` (type: `integer`):

When the attachments together are larger than this, they are left out, download links to the dataset are put in the body instead, and the result has the reason ATTACHMENT_TOO_LARGE_LINKED. The run does not fail.

## `provider` (type: `string`):

Your own SMTP server or one of the email APIs. The email is sent from your account, not from Apify.

## `smtpHost` (type: `string`):

For example smtp.gmail.com. Must be a public mail server; private, loopback and internal addresses are refused.

## `smtpPort` (type: `integer`):

587 (STARTTLS), 465 (implicit TLS), 2525 or 25. Other ports are refused.

## `smtpSecure` (type: `boolean`):

Connect with TLS from the first byte. Always on for port 465. Leave off for 587, 2525 and 25, where STARTTLS is used and required.

## `smtpUser` (type: `string`):

Usually your full email address.

## `smtpPassword` (type: `string`):

Stored encrypted. For Gmail use an app password, not your account password.

## `apiKey` (type: `string`):

Stored encrypted. Resend API key, SendGrid API key, Mailgun sending key, Postmark server token, or Brevo API key.

## `mailgunDomain` (type: `string`):

Mailgun only: your sending domain, for example mg.example.com.

## `mailgunRegion` (type: `string`):

Mailgun only: us (api.mailgun.net) or eu (api.eu.mailgun.net).

## Actor input object example

```json
{
  "to": [
    "you@example.com"
  ],
  "from": "Reports <reports@example.com>",
  "dryRun": true,
  "rows": [
    {
      "product": "Example A",
      "price": 19.99,
      "inStock": true,
      "details": {
        "color": "blue"
      }
    },
    {
      "product": "Example B",
      "price": 5,
      "inStock": false,
      "details": {
        "color": "red"
      }
    }
  ],
  "maxRows": 10000,
  "skipIfEmpty": false,
  "previewRows": 20,
  "attachmentFormats": [
    "csv"
  ],
  "maxAttachmentMb": 10,
  "provider": "smtp",
  "smtpPort": 587,
  "smtpSecure": false,
  "mailgunRegion": "us"
}
```

# Actor output Schema

## `result` (type: `string`):

One record per run: status (sent, dry_run, skipped_empty or failed), provider, message ID, number of recipients, number of rows, attachment names and sizes, reason codes, duration and whether the run was charged.

## `results` (type: `string`):

The same result as one dataset item, for use in integrations and tables.

## `preview` (type: `string`):

The HTML body rendered by a dry run. Exists only when dryRun was on.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## 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": [
        "you@example.com"
    ],
    "from": "Reports <reports@example.com>",
    "dryRun": true,
    "rows": [
        {
            "product": "Example A",
            "price": 19.99,
            "inStock": true,
            "details": {
                "color": "blue"
            }
        },
        {
            "product": "Example B",
            "price": 5,
            "inStock": false,
            "details": {
                "color": "red"
            }
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("teal_blacksmith/dataset-to-email").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": ["you@example.com"],
    "from": "Reports <reports@example.com>",
    "dryRun": True,
    "rows": [
        {
            "product": "Example A",
            "price": 19.99,
            "inStock": True,
            "details": { "color": "blue" },
        },
        {
            "product": "Example B",
            "price": 5,
            "inStock": False,
            "details": { "color": "red" },
        },
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("teal_blacksmith/dataset-to-email").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).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": [
    "you@example.com"
  ],
  "from": "Reports <reports@example.com>",
  "dryRun": true,
  "rows": [
    {
      "product": "Example A",
      "price": 19.99,
      "inStock": true,
      "details": {
        "color": "blue"
      }
    },
    {
      "product": "Example B",
      "price": 5,
      "inStock": false,
      "details": {
        "color": "red"
      }
    }
  ]
}' |
apify call teal_blacksmith/dataset-to-email --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,teal_blacksmith/dataset-to-email"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cSAxgg6cCSayahQFX/builds/rslNtg6zIBxJnLI7u/openapi.json
