# Winmail.dat Attachment Extractor — private acceptance (`creatieve_naald/winmail-dat-extractor`) Actor

- **URL**: https://apify.com/creatieve_naald/winmail-dat-extractor.md
- **Developed by:** [Stefan Schellen](https://apify.com/creatieve_naald) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$30.00 / 1,000 extracted winmail.dat files

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

## Winmail.dat Attachment Extractor

Recover files trapped inside an Outlook `winmail.dat` (TNEF) attachment, without installing a decoder or connecting your mailbox. Send one base64-encoded file and receive an ordered manifest plus downloadable binary attachments in the run's key-value store.

Useful when an email-to-document workflow sees `winmail.dat` instead of the invoice or other file it expected. This tool extracts bytes; your next step decides what to do with them.

### Input and output

Supply `{"tnefBase64":"...standard base64 of your file..."}`. The example input contains a small synthetic text attachment. For a local file:

```python
import base64, json
from pathlib import Path
print(json.dumps({"tnefBase64": base64.b64encode(Path("winmail.dat").read_bytes()).decode("ascii")}))
```

In n8n, download the attachment as binary, use Extract from File → Move File to Base64 String, and map that string to `tnefBase64` in an Apify Actor call. This workflow recipe has not been executed in n8n Cloud. Use an asynchronous run and wait for `SUCCEEDED` before reading `OUTPUT`.

The dataset contains one manifest. `files` contains `index`, `filename`, `recordKey`, `bytes` and `sha256`. Download each `recordKey` from the run's `defaultKeyValueStoreId` with your Apify authentication. Files use generated keys such as `attachment-001.bin`; repeated source filenames cannot overwrite each other. The suggested filename has directories and control characters removed. All binary records use `application/octet-stream`, so the service does not render their content. Storage access follows your Apify account settings; do not publish confidential run data.

### Price

$0.03 per successfully extracted TNEF file, with platform usage included in this pay-per-event price. One event per input file, not per attachment. Malformed, unsupported, over-limit and no-attachment inputs do not incur our extraction event. Successful output is saved before charging. Choose a maximum run charge of at least $0.03. Any platform fees outside this Actor's pricing, and later standalone storage/API use, follow your Apify account plan.

### Boundaries

- One decoded file up to **4 MiB**, up to **100 attachments**, up to 4 MiB total extracted bytes.
- Strict outer attribute lengths and checksums. Parser warnings cause failure instead of silently accepting partial results.
- Byte-preserving extraction with byte counts and SHA-256. This does not verify authenticity or scan for malware.
- No mailbox login, URLs, MSG/EML parsing, decryption, compressed RTF/body conversion, recursive archives or embedded Outlook message extraction. Embedded messages are rejected.
- Bounded parser worker: 10 seconds CPU, 15 seconds wall clock, 256 MiB address-space limit on Linux. Whole-run timeout 60 seconds. Unusual but valid files can be rejected.
- Extraction does not make an attachment safe. Keep your existing scanning/approval steps; do not execute untrusted files.

### Validation

26 local tests, including an upstream public fixture, malformed/checksum cases, Unicode filenames, duplicate names and restart charging. Private cloud checks covered small synthetic input, the 4 MiB input limit, corrupt checksum rejection and a cap below the event price. Successful output bytes and hashes were downloaded and verified. These are owner tests, not customer usage or evidence of payment demand. The n8n recipe remains untested in n8n Cloud.

### Alternatives and troubleshooting

If you control the sender, changing Outlook to HTML/plain text can eliminate TNEF at the source. For local use, the free [tnefparse](https://github.com/koodaamo/tnefparse) library and [Apache POI HMEF](https://poi.apache.org/components/hmef/index.html) avoid per-run service charges. This Actor is for workflows that prefer a hosted, bounded extraction step using their existing Apify access.

`NOT_TNEF`: this is not a raw winmail.dat file. `INVALID_BASE64`: remove data prefixes and use standard base64. `BAD_CHECKSUM`/`TRUNCATED_ATTRIBUTE`: obtain a fresh complete attachment. `COUNT_LIMIT`/`INPUT_LIMIT`: use a local decoder for larger inputs. `UNSUPPORTED_OR_MALFORMED`/`PARSER_WARNING`: the decoder cannot safely accept this file. `EMBEDDED_MESSAGE_UNSUPPORTED`: use a mail-specific decoder for nested messages. `SPENDING_LIMIT`: increase the run cap to the advertised single-file price.

Built with unmodified tnefparse 1.4.0 (LGPL-3.0; [source and license](https://github.com/koodaamo/tnefparse)). A checked compatibility setting enables final empty/one-byte attributes. No comprehensive Outlook-version compatibility claim. Support requests should contain synthetic examples, never confidential mail.

Part of [Agent Tools](https://apify.com/creatieve_naald). [Workflow examples](https://github.com/AI-AgentTools/workflow-examples).

# Actor input Schema

## `tnefBase64` (type: `string`):

Standard base64, no data: prefix. Decoded file at most 4 MiB. No mailbox credentials, URLs, EML or MSG files.

## Actor input object example

```json
{
  "tnefBase64": "eJ8+IgEAAgKQBgAOAAAAAQAAAAAAAAAAAAAAAAABAAIQgAEADAAAAGludm9pY2UudHh0AHsEAg+ABgAXAAAAU3ludGhldGljIGludm9pY2Ugb25seQq0CA=="
}
```

# Actor output Schema

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

No description

# 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 = {
    "tnefBase64": "eJ8+IgEAAgKQBgAOAAAAAQAAAAAAAAAAAAAAAAABAAIQgAEADAAAAGludm9pY2UudHh0AHsEAg+ABgAXAAAAU3ludGhldGljIGludm9pY2Ugb25seQq0CA=="
};

// Run the Actor and wait for it to finish
const run = await client.actor("creatieve_naald/winmail-dat-extractor").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 = { "tnefBase64": "eJ8+IgEAAgKQBgAOAAAAAQAAAAAAAAAAAAAAAAABAAIQgAEADAAAAGludm9pY2UudHh0AHsEAg+ABgAXAAAAU3ludGhldGljIGludm9pY2Ugb25seQq0CA==" }

# Run the Actor and wait for it to finish
run = client.actor("creatieve_naald/winmail-dat-extractor").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 '{
  "tnefBase64": "eJ8+IgEAAgKQBgAOAAAAAQAAAAAAAAAAAAAAAAABAAIQgAEADAAAAGludm9pY2UudHh0AHsEAg+ABgAXAAAAU3ludGhldGljIGludm9pY2Ugb25seQq0CA=="
}' |
apify call creatieve_naald/winmail-dat-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,creatieve_naald/winmail-dat-extractor"
        }
    }
}
```

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/kOd2r8Z2uomdR9XFb/builds/Wuqpdn6eQpDYhEIS7/openapi.json
