Dataset to Email — CSV, XLSX, JSON via your SMTP or API
Pricing
$5.00 / 1,000 email sents
Dataset to Email — CSV, XLSX, JSON via your SMTP or API
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.
Pricing
$5.00 / 1,000 email sents
Rating
0.0
(0)
Developer
도영 김
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
10 days ago
Last modified
Categories
Features
Share
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.ccolumns. - 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.
dryRunrenders 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
- Open the Actor or task whose results you want by email.
- Go to Integrations, choose to connect another Actor, and pick Dataset to Email.
- Choose when it runs (for example Run succeeded).
- Fill in
to,fromand the provider settings. TurndryRunoff. SetdatasetIdto{{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 thedatasetIdfield is the only one it is allowed to read — without it the run fails withDATASET_READ_FAILED. Remove the examplerows.
{{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. |
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. |
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:
{"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.5are 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
fieldsoromitFields, 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.csvwhen the Actor is unknown). - With 0 rows no file is attached.
Limits
- 20 recipients per run across
to,ccandbcc. One run sends one email. Not for bulk, promotional or unsolicited email — use it for reports and alerts to people who expect them. - Rows:
maxRowsdefaults to 10,000 and can be raised to 100,000. - Attachment size:
maxAttachmentMbdefaults 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.
sentmeans 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 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:
{"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