CLI Assert Mode
The rustmail assert subcommand starts an ephemeral SMTP server, waits for emails matching your criteria, and exits with code 0 (pass) or 1 (timeout/fail). No daemon required.
Usage
sh
rustmail assert [OPTIONS]Options
| Flag | Default | Description |
|---|---|---|
--timeout | 30s | Maximum time to wait for matching emails |
--min-count | 1 | Minimum number of matching emails required |
--subject | — | Filter by subject substring |
--sender | — | Filter by sender address substring |
--recipient | — | Filter by recipient address substring |
--smtp-port | 1025 | SMTP port to listen on |
Examples
sh
# Wait up to 30s for at least 1 email
rustmail assert
# Wait for 2 "Password Reset" emails within 60 seconds
rustmail assert --timeout=60s --min-count=2 --subject="Password Reset"
# Assert on sender
rustmail assert --sender=notifications@example.com --min-count=1Exit Codes
| Code | Meaning |
|---|---|
0 | Assertion passed — required emails were received |
1 | Assertion failed — timeout or criteria not met |
How It Works
- Starts an ephemeral SMTP server (in-memory, no database file)
- Listens for incoming emails
- Filters against your criteria (subject, sender, recipient)
- Exits
0as soon as--min-countmatching emails arrive - Exits
1if--timeoutis reached first
