Skip to content

Offline Mode & Outbox

Offline Mode & Outbox Queue

DodaMail is built as an offline-first desktop client. Unlike browser-based webmail clients that lock up or fail when your internet drops, DodaMail gives you full access to read, search, organize, draft, and queue messages while on flights, trains, or in locations with unstable connectivity.


1. Offline-First Architecture

Every message, attachment thumbnail, contact record, and folder structure is mirrored in your local SQLite database. When you lose connection:

  • Zero Interruption: You can browse your complete email history, open cached threads, view attachments, apply labels, move messages, and write responses.
  • SQLite FTS5 Local Search: Full-text keyword searches continue to execute at full speed locally without needing a server connection.
  • Deterministic Sync: Any actions taken offline (such as reading, starring, or deleting messages) are staged in a local transaction log and synchronized with your remote IMAP server as soon as the connection is re-established.

2. The Network Sentinel & Offline Status Banner

DodaMail runs a native Network Sentinel (network.ts) in the background. It combines standard OS network event listeners (window.addEventListener('offline')) with lightweight ping heartbeats to verify that your email server ports (IMAP 993 / SMTP 465) are actively reachable.

When connectivity drops, an Offline Banner appears across the top of the window:

+-------------------------------------------------------------------------+
| [!] Offline Mode: Working locally. Outgoing mail will queue in Outbox.  |
+-------------------------------------------------------------------------+

The sync indicator at the bottom of the sidebar transitions from Green to Amber (Offline).


3. The Outbox Queue (outbox.ts)

When you click Send while offline, DodaMail does not error or discard your work. Instead, it serializes the MIME envelope, stores all attachments in the local SQLite outbox table, and queues the message for delivery.

Sidebar Outbox Indicator

A red badge appears next to the Outbox folder in the sidebar displaying the number of pending emails:

> Outbox (3)

4. Controls on Outbox Messages

Navigating to the Outbox folder in the sidebar displays the queue of pending messages. Each queued card provides granular controls:

+-------------------------------------------------------------------------+
| Pending Delivery to: partner@enterprise.com                             |
| Subject: Signed Partnership Agreement & Exhibit A      [Attempt: 0/5]   |
| Queued: 14 minutes ago | Next automatic retry: On reconnection          |
|                                                                         |
| [ Retry Now ]    [ Edit Draft ]    [ Move to Drafts ]    [ Delete ]     |
+-------------------------------------------------------------------------+
Control Name Control Type Action & Behavior
“Retry Now” Action Button Immediately forces an SMTP connection attempt without waiting for the automatic retry timer.
“Edit Draft” Action Button Pulls the queued message out of the delivery queue and opens it back into the Message Composer, allowing you to update recipients, text, or attachments.
“Move to Drafts” Secondary Button Cancels outgoing delivery and transfers the message into your standard Drafts folder for future manual sending.
“Delete” Danger Button Permanently removes the queued message from local storage.

5. Automatic Reconnection & Exponential Backoff

When the Network Sentinel detects that internet connectivity has been restored:

  1. Immediate Outbox Sweep: DodaMail opens an authenticated TLS socket to your SMTP server and delivers queued messages sequentially.
  2. Exponential Backoff on Server Errors: If the network is online but your mail server returns temporary 4xx transmission errors (e.g., rate limits or greylisting), DodaMail applies an exponential backoff schedule:
    • 1st retry: after 1 minute
    • 2nd retry: after 2 minutes
    • 3rd retry: after 5 minutes
    • 4th retry: after 15 minutes
  3. Delivery Notification: Once the outbox queue clears successfully, a system notification alerts you:
    [ Outbox Cleared ]
    3 queued messages sent successfully.