Shipping a Flutter Desktop Email Archiver on the Microsoft Store (MSIX, Native Dart IMAP, PDF & MBOX)

2026-12-01来源 dev.toEnglish
Shipping a Flutter Desktop Email Archiver on the Microsoft Store (MSIX, Native Dart IMAP, PDF & MBOX)

Archivia Mail for Windows 10 and 11

If you have ever hit the storage limit on an IMAP mailbox (Gmail, Outlook, Aruba, custom business domains, or Italian PEC accounts), you know the usual choices on Windows:

  • Pay for another monthly storage upgrade forever, or
  • Spend an afternoon juggling desktop mail clients, proprietary .pst files, and fragile export plugins — hoping you don't accidentally delete emails before verifying they were actually saved.

I wanted something dead simple, 100% local, and one-time priced — so I built Archivia Mail in Flutter and just shipped version 1.5.0 on the Microsoft Store for Windows 10/11 (alongside iPhone, iPad, and macOS).

Here is what it does on Windows and a few lessons from packaging a Flutter desktop app as an MSIX for the Microsoft Store.

What Archivia Mail does on Windows

Everything runs locally on your PC — no intermediate servers, no account to register, no ads, and passwords are never written to disk:

  1. Connects directly via IMAP (auto-discovering settings for Gmail, Outlook/Hotmail via Microsoft OAuth, Aruba, Italian PEC as personal local backup, iCloud, Yahoo, Alice Mail, custom domains, etc.).
  2. Saves a clean local archive in Downloads › Mail Archive (organized by account → folder → YYYY-MM):
    • A readable PDF per email (with sender, recipients, date, subject, body, and CJK/Unicode font support)
    • Extracted attachments right next to the PDF
    • Original .eml copies openable in any mail client
  3. "Conversations as one PDF" — merges entire reply threads chronologically into a single readable PDF (with optional quote hiding).
  4. Portable .mbox export & mailbox migration — export any archived folder as standard .mbox for Thunderbird / Apple Mail, or upload archived emails directly into another IMAP mailbox with the same folders and zero duplicates.
  5. Verified server cleanup — by default, no email ever leaves the server unless it is verified on disk with all its files. Every message is tracked by folder + UIDVALIDITY + UID, re-checked before touching the server, and deleted strictly via UID EXPUNGE. If even a single file is missing, nothing is touched.
  6. New in v1.5.0 (live now on Microsoft Store):
    • Saved Mailboxes list on the login screen (stores only server settings & address — never the password)
    • Refresh mailbox button directly on the home screen
    • Alice Mail STARTTLS (port 143) preset

3 engineering choices that saved a lot of pain on Windows

1. Custom IMAP client in pure Dart (dart:io) — no connection pools, no IDLE

Because Archivia Mail is an on-demand archiver rather than an always-on mail client, skipping persistent connection pooling and IDLE avoided almost every cross-platform keep-alive headache:

  • Each job opens a single dedicated SecureSocket.connect (IMAPS) or SecureSocket.secure (after STARTTLS) with strict certificate verification (no onBadCertificate bypass) and closes cleanly with LOGOUT.
  • For long archiving runs where servers randomly drop sockets, a small retry wrapper reconnects with backoff, re-selects the folder, re-checks UIDVALIDITY, and resumes from the exact same UID — while stopping immediately on rate-limit/bandwidth refusals.
  • For Outlook/Hotmail OAuth, Microsoft drops the IMAP session the moment the access token expires, so the client proactively rotates the connection ~10 minutes before expiry (authValidUntil) so big attachments never get cut off mid-transfer.
  • Supporting COMPRESS=DEFLATE (RFC 4978) when advertised speeds up attachment-heavy folders dramatically.

2. Packaging Flutter Desktop for the Microsoft Store with msix

Turning a flutter build windows --release into a Store-ready MSIX was smoother than expected once a couple of subtleties were sorted out:

  • Using msix in pubspec.yaml with store: true builds the unsigned Store package (Microsoft signs it during certification).
  • Setting trim_logo: false prevented msix from aggressively cropping our square app icon.
  • Passing --build-windows false after flutter build windows --release avoided compiling the C++ runner twice.
  • Because Flutter desktop apps on Windows declare runFullTrust in the generated AppxManifest.xml, Partner Center asks for a short technical justification in Submission options — explaining clearly that the app writes the user's PDF/attachment/.eml archive directly to Downloads\Mail Archive got both our initial release (1.4.0) and v1.5.0 through certification cleanly in ~24 hours.

3. Single Flutter codebase across Windows, macOS, iOS, and Android

Keeping all core logic (IMAP parser, MIME decoder, PDF generator running in a background Isolate, thread merger, .mbox exporter) in pure Dart means fixes and user-requested features ship everywhere at once. All three features in v1.5.0 came straight from a user's feedback and landed on Windows, Mac, iPhone, and iPad within 48 hours.

Try it on Windows (or Apple)

Happy to answer any questions about Flutter Windows desktop builds, MSIX certification, or writing an IMAP client from scratch in Dart!

原文:https://www.a8q9.cn/en/article/shipping-a-flutter-desktop-email-archiver-on-the-microsoft-store-msix-native-dar-928f7c.html

相关文章