# Download Raw Received Email

> GET /emails/receiving/:id/raw — download the original RFC 822 .eml bytes for a received email.

`GET /emails/receiving/:id/raw`

Downloads the original RFC 822 message bytes for a received email. Unlike most API endpoints, this route does **not** return a JSON object — the response body is the raw `.eml` binary. The response carries:

- `Content-Type: message/rfc822`
- `Content-Disposition: attachment; filename="<id>.eml"`
- `X-Content-Type-Options: nosniff`

The SDK method `mb.emails.receiving.getRaw(id)` returns an **`ArrayBuffer`** containing the raw bytes. Parse or save it as a binary file — do not treat it as JSON.

Not every received email has stored raw bytes; if the original message was not retained, the endpoint returns `not_found`.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The id of the received email. |

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

const { data, error } = await mb.emails.receiving.getRaw('4ef9a417-02e9-4d39-ad75-9611e0fcc33c');
console.log({ data, error });
```

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

SendDart::Emails::Receiving.get_raw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendDart\SendDart;

$senddart = SendDart::client('mb_xxxxxxxxx');

$senddart->emails->receiving->getRaw('4ef9a417-02e9-4d39-ad75-9611e0fcc33c');
```

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

senddart.Emails.Receiving.get_raw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**Go**

```go
import "github.com/shekhu10/senddart-sdks/senddart-go"

client := senddart.NewClient("mb_xxxxxxxxx")

raw, err := client.Emails.Receiving.GetRaw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**Rust**

```rust
use senddart::SendDart;

let mb = SendDart::new("mb_xxxxxxxxx");

let _raw = mb.emails.receiving.get_raw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c").await?;
```

**Java**

```java
import com.senddart.SendDart;

SendDart senddart = new SendDart("mb_xxxxxxxxx");

byte[] data = senddart.emails().receiving().getRaw("4ef9a417-02e9-4d39-ad75-9611e0fcc33c");
```

**.NET**

```csharp
using SendDart;

ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx");

var resp = await senddart.ReceivedEmailGetRawAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c");
```

**cURL**

```bash
curl -X GET 'https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/raw' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
senddart emails receiving raw 4ef9a417-02e9-4d39-ad75-9611e0fcc33c
```

## Response

On success the response body is the raw RFC 822 message bytes (binary, not JSON). Save or stream the body as a `.eml` file.

```bash
HTTP/1.1 200 OK
Content-Type: message/rfc822
Content-Disposition: attachment; filename="4ef9a417-02e9-4d39-ad75-9611e0fcc33c.eml"
X-Content-Type-Options: nosniff

<raw RFC 822 message bytes>
```

Returns `not_found` (404) if the received email does not exist for your account, or if no raw message was stored for it. See the [error reference](https://www.senddart.com/docs/api/errors).
