# Sent-mail log

No message leaves the simulator: every send Gmail would deliver is one event in the egress log, the same on every route.

The sent-mail log is how a test sees the mail your code would have delivered: a send never reaches a mailbox, it lands in `GET /_rystic/egress`. Send a message and read the log:

```bash
curl -s -X POST "$RYSTIC_URL/_rystic/scenario" -d '{"name":"gmail_busy_inbox"}' -o /dev/null
G=(-H 'Authorization: Bearer ya29.placeholder')
RAW=$(printf 'From: ada.lovelace@example.com\r\nTo: marcus.bell@northwind.example\r\nCc: grace.hopper@example.com\r\nSubject: Status\r\n\r\nShipped.\r\n' | base64 | tr '+/' '-_' | tr -d '\n')
curl -s "$RYSTIC_URL/gmail/v1/users/me/messages/send" "${G[@]}" -H 'Content-Type: application/json' -d "{\"raw\":\"$RAW\"}" | jq -c '{labelIds}'
# -> {"labelIds":["SENT"]}
curl -s "$RYSTIC_URL/_rystic/egress" | jq -c '.events[] | {effect, type, from: .payload.from, subject: .payload.subject, to: .payload.to, cc: .payload.cc}'
# -> {"effect":"eff_send_mail","type":"message.sent","from":"ada.lovelace@example.com","subject":"Status","to":["marcus.bell@northwind.example"],"cc":["grace.hopper@example.com"]}
```

### What an event holds

Every send Gmail would deliver records one event, the same on every route: `messages.send` as JSON, media upload or multipart upload; `drafts.send` as JSON or multipart upload. The event has effect `eff_send_mail`, type `message.sent` and a payload with:

- the sent message's `messageId` and `threadId`;
- its `from` and `subject`;
- the addresses its headers name in `to`, `cc` and `bcc`, each a list of bare addresses;
- its `raw` bytes, as `messages.get` with `format=raw` returns them.

### What records nothing

A refused send records nothing, and so does a `drafts.send` by media upload, which Gmail always refuses. Loading a scenario records nothing either, and `POST /_rystic/reset` clears the log. [Observing](https://www.rystic.ai/docs/concepts/observing.md) covers reading it.

---

Source: https://www.rystic.ai/docs/simulators/gmail/features/sent-mail · Markdown: https://www.rystic.ai/docs/simulators/gmail/features/sent-mail.md
