# 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 { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

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

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := sendping.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use sendping::SendPing;

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

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

**Java**

```java
import co.sendping.SendPing;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

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

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

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

**cURL**

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

**CLI**

```bash
sendping 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.sendping.co/docs/api/errors).
