> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Attachments and forwarding

# Attachments & Email Forwarding

Learn how to handle files attached to incoming emails and set up automatic email forwarding.

***

## Accessing Inbound Attachments

Inbound attachments are parsed automatically and made available via secure, pre-signed download URLs inside the `attachments` array of the `email.received` webhook payload:

```json theme={null}
{
  "filename": "quarterly-report.pdf",
  "content_type": "application/pdf",
  "size": 524288,
  "download_url": "https://api.mailofly.com/inbound/attachments/att_abc123"
}
```

* Download URLs are valid for **24 hours**.
* Alternatively, you can retrieve the raw attachment stream via the Mailofly SDK:

```typescript theme={null}
const stream = await mailofly.inbound.getAttachmentStream("att_abc123");
```

***

## Email Forwarding Rules

If you do not want to build a webhook handler and simply want incoming emails redirected to another email address:

1. Open **Domains** → select your receiving domain.
2. Under **Inbound Routing**, click **Add Forwarding Rule**.
3. Set the match rule:
   * **Catch-all (`*@yourdomain.com`)**: Forwards any incoming email to your destination address.
   * **Exact match (`hello@yourdomain.com`)**: Forwards only specific mailbox aliases.
4. Set the destination address (e.g. `team@gmail.com`).
5. Click **Save Rule**. Mailofly will forward matching messages with original headers preserved.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.