Home › Guides › Inbox lifecycle

What Happens When a Temporary Inbox Expires?

A temporary inbox is useful precisely because its contents do not have to stay around. But the word expires can mean several things. The message can stop appearing in the inbox, the service can remove its stored copy, or the address itself can stop receiving mail. Those events do not necessarily happen at the same instant. Before using a disposable address, choose a message lifetime long enough for the task, then assume the message may become inaccessible as soon as that lifetime ends.

TempMailPortal currently offers 10-minute, one-hour and 24-hour message retention for a newly created private inbox. The selected period applies to each message from when it arrives. It is not a promise that a sender will deliver within that time, nor a timer that starts when you open the message. The mailbox can also expire separately; a message cannot outlive the mailbox's own expiry. For a confirmation email that you might need again next week, none of these choices is appropriate.

The first clock: when the message becomes unavailable

When a sender delivers a message, the receiving Worker records an expires_at timestamp. The message-list and message-detail API queries include a condition requiring that timestamp to be in the future. Once the timestamp passes, the API should not return the message, even if its database row has not yet been physically removed. This is the useful meaning of expires for someone using the inbox: the message is no longer available for reading.

The three choices are relative to receipt. If a ten-minute message arrives at 10:00, its access window is intended to end around 10:10. If the same message arrives at 10:08, its own window ends around 10:18, subject to the mailbox's expiry. These times are examples of how the configured arithmetic works, not results from a live delivery test. A sender may queue or reject mail, and the service cannot extend a message's lifetime just because it arrived late for your task.

In our local Worker test, we sent a synthetic message directly into the receiving handler for each setting. The stored deadlines were 10 minutes, one hour and 24 hours after receipt, even though the message declared a much older sender date. We then set each test inbox’s deadline to one minute away and delivered another message. Each new message inherited that earlier deadline. This test checked the stored timestamps without waiting for the full intervals or sending mail through an external provider.

This matters most for codes and one-time links. A sender may say its code is valid for ten minutes, while the inbox has a separate ten-minute retention setting. Those two clocks are independent. The code can become invalid before the email disappears, or the email can disappear while the code would still be valid. If the account is valuable or needs recovery, use a stable address you control instead. Google's account recovery guidance relies on durable recovery information; a short-lived inbox is a poor substitute.

The second clock: when stored copies are removed

An expired message should not be confused with a row already removed from storage. TempMailPortal runs a periodic scheduled cleanup. The cleanup selects expired messages, removes any retained attachment objects, and deletes their database rows in bounded batches. Cloudflare's Cron Trigger documentation explains that a scheduled() handler runs periodically, rather than at each individual message's expiration instant.

Because cleanup is periodic and batch-limited, physical removal can happen later than access expiry, especially after a large wave of expiring messages or a missed run. The API's expiry condition is the immediate access boundary; the sweep is storage reclamation. This distinction is why the privacy and acceptable-use pages say messages become unavailable after the selected lifetime and stored copies are removed by scheduled cleanup. It would be inaccurate to promise that every byte is erased at the exact ten-minute, one-hour or 24-hour mark.

The current implementation separates those stages deliberately:

Stage What the implementation does What the reader should assume
Receipt Calculates a message-specific expiry from the receipt time and selected retention, capped by the mailbox expiry. The countdown starts when TempMailPortal receives the message, not when it is opened.
Access expiry Message-list, message-detail and attachment-download queries require expires_at to still be in the future. The message and its files can become unavailable immediately at the boundary.
Cleanup selection A scheduled job selects the oldest expired messages in batches of up to 200 per run. Storage reclamation can lag behind access expiry when more than one batch is waiting.
Object cleanup The job deletes retained attachment objects before deleting the matching database rows. A database row is not proof that its file remains downloadable; the public route is already blocked by expiry.
Retry after failure If object deletion fails, the job keeps the database references and throws so a later run can retry. Cleanup is designed to avoid losing the list of objects that still need removal, but no exact removal minute is promised.

This ordering is a failure-safety choice, not an archive feature. Cloudflare documents that R2 deletion is strongly consistent after the delete promise resolves and that one Workers API call can delete up to 1,000 keys. TempMailPortal groups object keys within that limit. The production bucket's actual lifecycle-rule configuration has not been verified for this guide, so a separate bucket lifecycle backstop is not claimed as active.

Attachments are a further reason to describe this carefully. The receiving Worker can place eligible attachment bytes in private object storage. Message expiry blocks access through the message-scoped download route; cleanup removes retained objects. The website shows attachment details but does not offer attachment downloads. These statements describe the current implementation; a live attachment-delivery test is not claimed here.

The third clock: when the address itself stops working

The address and its messages have separate lifetimes. The current implementation gives a browser-created private address a seven-day mailbox lifetime and a stateful app-created address a 30-day lifetime. That does not mean messages remain readable for seven or 30 days; they still use their selected short retention and are capped by the mailbox expiry. An address can exist while its earlier messages have already expired.

Once a private mailbox record expires, the receiving Worker rejects new mail for that name. It does not keep an archived inbox to reopen later. A browser also stores the private access credential locally. Losing that credential, switching to a different browser profile, or clearing site data may prevent you from returning to a still-active mailbox. Someone who has the address alone should not be able to read the private inbox; someone who has the credential can. Treat that credential as a secret.

What changing the address does not do

Generating another address does not instantly erase messages stored under the previous address. The earlier mailbox and its messages follow their own expiry unless you explicitly delete that inbox. The same applies when you remove a saved address from the browser: forgetting a local credential is not a server-side deletion request. If the old inbox contains something you want removed now, open that inbox while you still have access and use its Delete action, then wait for the success confirmation.

Do not mistake a blank inbox for proof of permanent deletion. A blank list can mean no mail has arrived, the credential is wrong, the message has expired, the address was deleted, or the service is temporarily unavailable. If a sender says it sent a message but you see nothing, check the exact copied address, the sender's delivery result, the selected lifetime and the current inbox. Do not repeatedly create addresses to compensate for a sender-side failure.

A practical choice

Choose ten minutes for a controlled, low-stakes test where you are watching the inbox and can request another message. Choose one hour when an ordinary sender may take a little longer. Choose 24 hours when you may need to return later that day, while still accepting that the message is temporary. These are decision examples, not deliverability guarantees. Avoid all three for banking, work, school, healthcare, government accounts and password recovery.

The key distinction is simple: unavailable to read is enforced by the message expiry timestamp; removed from storage follows scheduled cleanup; address no longer receives follows the mailbox's separate expiry. Plan around the earliest boundary and save only information you are permitted and comfortable keeping elsewhere.

Sources and verification

The separate message and mailbox clocks were checked against the Worker retention and cleanup code. A scheduled cleanup interval is not a promise of an exact deletion instant.