# Real attachments check: do uploaded files arrive?

Sending files from the CRM (HUB-168): upload each with `POST /api/v1/inbox/attachments`, then
send with their ids in `attachmentIds`. The tests use a fake Gmail, so this is checked once with a
real mailbox. It needs the same setup as [the real send check](gmail-real-send-check.md), plus the
nginx upload limit from `deploy/README.md` on staging.

## Steps

1. **Upload two files** in Swagger (`/docs`, "inbox" → `POST /inbox/attachments`, "Try it out",
   pick a file): a small PDF and an image. Each answers `201` with an `attachmentId`.

2. **Send** with `POST /api/v1/inbox/send`:

   ```json
   {
     "to": ["<your second address>"],
     "subject": "CRM attachments check <today's date>",
     "bodyHtml": "<p>Two files attached (HUB-168).</p>",
     "idempotencyKey": "real-attachments-check-0001",
     "attachmentIds": ["<first attachmentId>", "<second attachmentId>"]
   }
   ```

   Within a minute `GET /api/v1/inbox/threads/<thread id>` shows `sendStatus: "sent"`.

3. **Check the recipient's mailbox:** the email arrives with **both** files, and both open
   correctly. **Take a screenshot.**

4. **Too large:** upload two files of about 15 MB each and send them together: the answer is `400`
   "The attachments are larger than 25 MB" and nothing is sent.

5. **Blocked type:** upload a file named `test.exe`: `400`, "Gmail does not allow .exe files".

6. **Cleaned up:** after step 2 the two files are no longer in `EMAIL_UPLOAD_DIR`. The 15 MB
   files from step 4 are deleted by the worker within an hour after they expire (24 h after the
   upload).

## Result

Fill this in and attach the screenshot to the ticket (HUB-168).

|                                                  |                     |
| ------------------------------------------------ | ------------------- |
| Date, environment                                |                     |
| Who ran it                                       |                     |
| Both files arrived and open (step 3)?            |                     |
| 30 MB set refused (step 4)?                      |                     |
| .exe refused (step 5)?                           |                     |
| Sent files gone from the upload folder (step 6)? |                     |
| Screenshot                                       | attached to HUB-168 |
