Mail round trip (mail_roundtrip)
Sends a message whose subject carries a unique tag over SMTP mail submission, waits for it to appear in the account's mailbox read over IMAP or POP3, reports how long that took, and deletes it. This is the check that mail really gets through, not only that the services answer.
What it looks like

The page of a mail round trip sensor after a few polls, sending over submission with STARTTLS and reading back over IMAP on a lab server. In the dark theme: the sensor's page. The form for adding it, with its parameters filled in: light, dark.
What one poll does
- Signs in to the mailbox (IMAP or POP3). A wrong password or a missing mailbox fails here, before anything is sent.
- Deletes the messages whose subject starts with the sensor's prefix and whose tag is older than
cleanup_after_secs. They are the leftovers of runs that failed. - Sends the message from and to
addressover submission (STARTTLS and AUTH by default), with a subject<prefix>-<unix time>-<random>, anAuto-Submitted: auto-generatedheader and a body that says what it is. - Looks at the mailbox every
poll_interval_msuntil the tag appears, or until about four fifths of the poll timeout have passed. - Deletes the message, signs out, and reports. On a timeout it looks once more, deletes the message if it has arrived by then, and fails with kind
timeout; a message that still arrives later is deleted by the next run as a leftover.
Nothing piles up, and the sensor only deletes messages whose subject starts with its own prefix. Two sensors that watch the same mailbox can share a prefix: a run never touches a message younger than cleanup_after_secs that is not its own. A POP3 mailbox is a snapshot taken at sign-in, so the sensor signs in again for every look, and deletions take effect when it signs out.
Channels
| Key | Name | Unit | Default limits |
|---|---|---|---|
roundtrip_ms | Round trip (from the start of sending until the message was found) | ms | warning above 15000, error above 45000 |
send_ms | Time to send (connecting, TLS, signing in and the server accepting the message) | ms | warning above 5000, error above 15000 |
delivery_ms | Delivery (the server accepted it until it was found) | ms | none |
removed | Old messages removed | none |
Parameters
| Parameter | Default | Meaning |
|---|---|---|
address | required | The address the message is sent from and to: the account whose mailbox is read back, which the login credential belongs to. |
smtp_port, smtp_security | 587, starttls | Submission. With smtp_security tls the port defaults to 465. |
retrieval | imap | imap or pop3. |
retrieval_port, retrieval_security | 993, tls | The mailbox connection; 995 for POP3 over TLS, 143 or 110 without. |
mailbox | INBOX | IMAP only: where the message arrives. |
subject_prefix | probeward-roundtrip | What every subject starts with; 1 to 64 letters, digits, -, _ or .. Messages with this prefix are the sensor's own. |
cleanup_after_secs | 900 | Messages with the prefix older than this are deleted. At least 60. |
poll_interval_ms | 1000 | Between looks at the mailbox, 200 to 10000. |
allow_plaintext_login | false | Allow none for either connection, which sends the password in the clear. |
helo_name | the probe's address in brackets | What to say in EHLO. |
verify_tls, tls_fingerprint, server_name | as for SMTP | The certificate rules, for both connections: they must be to the same server and certificate. |
Suggested interval: 300 seconds. Credential: a login credential, required; one account does the sending and the reading. Set the poll timeout well above the delivery time you expect, for example 30 to 60 seconds: the default of 10 seconds is shorter than a slow mail system needs, and the interval must stay above the timeout.
On the target
An account that can submit mail (AUTH on the submission port) to its own address and read and delete in its mailbox. Mail to that address must be delivered to that mailbox; a filter that moves or discards mail from the account to itself defeats the check.
Failures
| Message | Meaning |
|---|---|
the message was accepted (...) but did not appear in the mailbox within N s (kind timeout) | Delivery is slow or broken. The reply of the server is quoted, which usually carries the queue id. |
the server rejected the login (kind auth_failed) | At the mailbox, before sending, or at submission. |
SMTP refused the sender, ... refused the recipient (kind protocol) | Submission refused the message; relay rules or the sender address. |
| the connection and certificate failures of SMTP and IMAP |
Testing
The live tests in crates/probeward-sensors/tests/mail_ftp_live.rs run against a real mail server when these variables are set, and print one line and return when they are not:
| Variable | Meaning |
|---|---|
PROBEWARD_TEST_MAIL_HOST | The server's address. |
PROBEWARD_TEST_MAIL_NAME | The name its certificate carries, sent as the TLS server name. |
PROBEWARD_TEST_MAIL_USER, PROBEWARD_TEST_MAIL_PASSWORD | An account on it. |
PROBEWARD_TEST_MAIL_ADDRESS | That account's mail address. |
PROBEWARD_TEST_MAIL_CA_FILE | The PEM file of the authority that issued the certificate. |
cargo test -p probeward-sensors --test mail_ftp_live -- --nocaptureThe protocol steps themselves (STARTTLS and its downgrade and injection cases, AUTH PLAIN and LOGIN, IMAP literals, POP3 deletion on sign-out) are tested against scripted servers in tests/mail_proto.rs, and the sensors' own judgement against scripted clients in tests/sensors_mail_ftp.rs, without a network.