# `email.attachment_limit`

Email's attachments may exceed what its mail package accepts.

Area 16, [Built-in services](../topics/built-in-services.md); not declinable; the next step is usually the agent's.

Through a mail package, an email's `File` fields go as attachments to a
provider that accepts so much in all, its `limits: { attachments: }`, so
each field says the most it may hold and together they fit:








```jadpo
/// Sends each email through `transmissions.send`.
provide email {
    send: {
        call: transmissions.send
        input: {
            from: message.from
            to: message.to
            subject: message.subject
            html: message.html
            text: message.text
            attachments: {
                each: message.attachments
                as: {
                    filename: item.name
                    content: item.content
                }
            }
        }
    }
    limits: {
        attachments: 10mb
    }
}
```



```jadpo
/// Sends a customer their invoice.
type InvoiceEmail = EmailMessage {
    name: Text
    invoice: File {
        max_size: 12mb
    }
}
```

```text
error: `InvoiceEmail`'s attachments may be 12 MB, over the 10 MB `postbox` accepts
 --> domains/billing/emails/invoice_email.jadpo:2:6
  |
2 | type InvoiceEmail = EmailMessage {
  |      ^^^^^^^^^^^^ too large to send
  reason: An email's `File` fields are sent as attachments, each at most its `max_size:`, and `postbox`'s package accepts 10 MB of them in all, so an email at its largest would be refused.
  next: Lower the `max_size:` of `InvoiceEmail`'s `File` fields to 10 MB in all, or send the biggest files as links (agent)
  rule: email.attachment_limit
  help: https://jadpo.dev/docs/errors/email.attachment_limit

check failed: 1 error, 10 files
```
