Email Migration

Migrate Stalwart to Office 365 from your live server or a copy of its database

Leena Taylor Paul By Updated November 14, 2026 8 min read

Quick Answer

Nothing in Stalwart sends a mailbox to Office 365. Its export and import command only moves the internal database between storage types. Two ways reach Microsoft 365. The IMAP copy by Microsoft works from your live Stalwart server and moves mail folders only. A mailbox is limited to 500,000 items. You can also convert a RocksDB or SQLite database copy into PST files with the server off.

Stalwart documents its export tool as a way to move its own database. It describes no way to send mail to another service.

You manage a Stalwart server and Microsoft 365 is the next platform, so you are probably looking for a button that sends mailboxes across. Stalwart's database migration page describes a command that moves its internal database between storage types, for example from RocksDB to PostgreSQL. It does not describe a way to send mail to another mail service. Two methods remain open. Microsoft can copy the mail over IMAP while Stalwart is online. Otherwise a copy of your database can be turned into files.

My choice depends on the state of your server. If Stalwart still starts, Microsoft's IMAP migration needs no extra program. Stalwart also lets an administrator sign in to other accounts, so you may not need every password. If Stalwart is off or you need files, a database copy is the only method I found that works, because Stalwart's RocksDB page says only one process can open the database directory at a time.

Choose a method by the state of your server
  • If your Stalwart server is online and you can sign in to every account, send the mail through Microsoft's IMAP migration.
  • If your server was shut down or refuses an old database, stop the service, copy the database directory and convert that copy into PST files.
  • If your database is PostgreSQL, MySQL or FoundationDB, use IMAP, because the migrator on this page reads RocksDB and SQLite copies.

Why Does Stalwart Have No Way to Send Mail to Office 365?

Stalwart's migration utility is built into the main program and starts with --export or --import plus a --config file. It moves the internal database between storage types and does not read mail from other servers. The same page asks you to stop the server first, because the utility reads the raw data directly. It also says the utility is not a substitute for regular backups.

Stalwart's storage overview explains why a plain file copy is not mail you can open. The data store keeps accounts, mailboxes and message metadata, while the blob store keeps the raw messages and their attachments. By default the blob store sits inside the data store. If you moved it to a filesystem directory or an S3-compatible service, your mail lives in two places.

Microsoft's IMAP migration page sets the limits of that method. Each of your mailboxes is limited to 500,000 items and each message to 35 MB. Only mail folders are copied. Your contacts, calendar items and tasks need another method. Microsoft copies the newest mail first.

Who Moves Stalwart Mail to Microsoft 365?

Which of these describes your Stalwart server?
  • A small company admin Your team chose Microsoft 365 and your Stalwart server will be switched off after the move.
  • An admin after an upgrade Stalwart v1.0 refuses a database made by an earlier version, so your old mail sits in files that the new server will not open.
  • A self-hosting family You host mail for relatives and want each person in Outlook before you shut the machine down.
  • A departing manager One mailbox must reach Microsoft 365 before you close the account.

Which Method Fits Your Stalwart to Office 365 Migration?

Only two methods exist for this move. The table shows what each one needs and where it stops.

MethodHow it worksWhat blocks it
IMAP migration by Microsoft Microsoft 365 connects to your online Stalwart server and copies every mailbox folder by folder Needs Stalwart online, credentials for each account and Microsoft 365 mailboxes that already exist
Files from a database copy A Windows application reads a copy of your RocksDB or SQLite database. It then creates PST, EML or MBOX files or sends mail to an IMAP host Needs the full licence for the export and a Windows 11 or 10 PC. A PST needs its own import into Microsoft 365. PostgreSQL, MySQL and FoundationDB are outside it

My choice follows the state of the server. A healthy Stalwart server and a short list favour IMAP, because Microsoft does the copying. A stopped server or a wish for files favours the copy. However, no Stalwart page that I read describes another way to open the database outside Stalwart. Also, PST files from a copy can be opened in Outlook before anything reaches Microsoft 365.

Copy the whole Stalwart database and move two test accounts from it before you plan the rest. If both open correctly in Microsoft 365, your other accounts will follow the same steps.

Nick Rogers, Founder of Univik
Nick Rogers
Founder, Univik
Making Windows software since 2013

Five Steps to Send Stalwart Mail Into Microsoft 365 Over IMAP

The Microsoft screens are in the migrate IMAP to Office 365 guide on this site, so the steps below stay on the Stalwart side.

  1. Check the IMAP listener. Stalwart's IMAP page shows a listener named imap on port 143 and one named imaptls on port 993 with implicit TLS. Open your configuration and check that an IMAP listener is active and that Microsoft 365 can reach it.
  2. Create the Microsoft 365 users. Set up every Microsoft 365 user and give each one a licence, since Microsoft fills mailboxes that already exist. A domain that you want to move needs ownership verified with your registrar.
  3. Choose how Microsoft signs in. Gather each account password or use the administrator sign-in that Stalwart permits. Then put the addresses in a CSV file.
  4. Turn off retention rules. Before the batch, turn off Messaging Records Management (MRM) and archival policies for the new mailboxes, as Microsoft's IMAP page advises.
  5. Start the batch and switch. Open the Exchange admin center and add Stalwart as the migration endpoint. Start the batch with your CSV file. After a few mailboxes match their Stalwart originals, change your MX record.

Stalwart's administrator page describes a master-user sign-in over IMAP. You type the username as target%impersonator and use the administrator's own password. The account needs the impersonate permission. The System Administrator role includes it. App passwords, administrators with two-factor sign-in and suspended accounts are refused. I haven't tested whether Microsoft's CSV file accepts that username form, so try it on one mailbox before you plan the whole list.

Convert a Copy of the Stalwart Database Into PST Files

Univik Stalwart Migrator opens your RocksDB or SQLite database copy together with its blobs and lists the accounts inside. Stalwart can stay off while it reads. The migrator then creates PST, EML or MBOX files or sends the mail to an IMAP server that you name.

Everything happens on your Windows PC from the copy, so your live server is never contacted.
  1. Stop and copy. Stop the Stalwart service first, since Stalwart's backup page says a RocksDB backup is a copy of the directory named by the path setting. Copy that directory to your Windows PC, plus the blob directory if your blob store is a filesystem one.
  2. Load the copy. Open the migrator and choose the database that you copied. Its accounts are listed. The list can be filtered.
  3. Choose PST. Add your CSV list of accounts and set the format to PST. Preview one mailbox before you go on.
  4. Begin the batch. Begin the batch and read its log at the end. A stopped batch can resume. I'd also note how long one account took.
  5. Check the result. Open two or three PST files in Outlook and match their folders against your Stalwart accounts before you import anything.

Limitations: the trial version moves only 25 messages per folder. The migrator requires Windows 11 or Windows 10 with .NET Framework 4.8. My testing never included the migrator's own upload to Microsoft 365, so this guide ends with PST files for the Microsoft side. My own timing never covered a large database. If you plan a big server, move two accounts first.

Turn your Stalwart copy into PST files

Windows turns your RocksDB or SQLite copy into one PST file for each account on your list.

Download Free Trial Select a Licence - From $999

Try the trial on two accounts and check the results in Outlook before you buy.

Bring Your PST Files Into Microsoft 365

A PST reaches Microsoft 365 in two ways. For one or two people, open classic Outlook and import the PST under File, Open & Export and Import/Export. A large number of accounts goes through the Microsoft Purview Import service, which takes uploaded files. Microsoft's overview limits a PST to 20 GB. It leaves out items over 150 MB. Our import PST to Office 365 guide shows the screens.

What If Stalwart Mail Is Missing in Microsoft 365?

1. Microsoft cannot sign in to Stalwart

Do this: If Microsoft reports a failed sign-in, check the account type first. Stalwart refuses app passwords for the master-user sign-in. An administrator with two-factor sign-in cannot use it either. A suspended account refuses it too, so use the account password for those.

2. Your copy lists accounts without message text

Do this: When your blob store is separate from the data store, a copy of the data store alone has records and no raw messages. Copy the blob directory as well and add both before you start the batch.

3. Older messages are missing after the batch

Do this: IMAP migration refuses mail beyond 500,000 items for one mailbox or 35 MB for one message. Check the mailbox against your copy, since the live server has newer mail that the copy never contained.

If a mailbox still looks incomplete, contact Univik support with your Stalwart version and the account involved.

How Were the Stalwart Facts Checked?

On 14 November 2026 I read seven Stalwart pages: the IMAP overview, the storage overview, the backup page, the migration page, the RocksDB page, the administrator page and the 1.0 release post. I then read two Microsoft pages, one on IMAP migration and one on Purview PST import. Univik's migration page was the ninth, because every step here should match what the migrator can do. I never tested a live Stalwart server against Microsoft's IMAP migration, so the master-user username form is untested.

Key Takeaways
  • Stalwart's export and import command only moves its database between storage types. Mail reaches Microsoft 365 through IMAP or through PST files built from a copy.
  • An administrator with the impersonate permission can sign in to other accounts over IMAP as target%impersonator.
  • RocksDB lets one process open its directory, so stop Stalwart before you copy it.
  • Microsoft's IMAP migration moves mail only, with a limit of 500,000 items in a mailbox.
  • Check two test accounts against your copy before the MX record changes.

FAQ: Migrate Stalwart to Office 365

How do I migrate Stalwart to Office 365?

Send the mail through Microsoft's IMAP migration while your Stalwart server is online. As an alternative, convert a RocksDB or SQLite database copy into PST files and import them. IMAP copies mail only and needs a sign-in for each account.

Can Stalwart export mailboxes to Microsoft 365 by itself?

Stalwart's export and import command moves its internal database between storage types. The migration page says it does not cover importing from other mail servers. It describes no way to send mail to Microsoft 365.

Which ports does Stalwart use for IMAP?

Stalwart's IMAP page shows a listener on port 143 and an implicit TLS listener on port 993 in its example configuration. Your own server may use other ports, so check your configuration.

Can I sign in to every Stalwart mailbox without each password?

An administrator with the impersonate permission can sign in over IMAP with the username target%impersonator and the administrator's own password. App passwords and two-factor sign-in are refused, so test one mailbox first.

What are the limits of Microsoft's IMAP migration?

Microsoft sets 500,000 items as the mailbox limit and 35 MB as the message limit. Mail folders are the only thing it copies. Contacts, calendar items and tasks are left out.

Can Stalwart mail move while the server is off?

Yes, if you work from a RocksDB or SQLite database copy. A migrator reads the copy on a Windows PC and creates files in PST, EML or MBOX format.

Can I test the Stalwart migrator for free?

Yes. The trial of Univik Stalwart Migrator moves only 25 messages per folder, enough for a test with your own accounts.

Does a database copy work for PostgreSQL or MySQL?

No. The migrator reads RocksDB and SQLite copies only. If your data store is PostgreSQL, MySQL or FoundationDB, use Microsoft's IMAP migration instead.

Leena Taylor Paul

Seven Stalwart pages and two Microsoft Learn pages supplied the facts in this guide. I read them all on November 14, 2026.

More Guides for Stalwart and Microsoft 365

Choose the guide that matches your Stalwart server or the next step on the Microsoft side.