A lightweight PHP tool for moving a mailbox from one IMAP server to another, built by Host Hobbit for client email migrations.
Enter the source and destination mailbox details in a web form and every message in the source inbox is copied across, byte for byte, keeping:
- attachments and HTML formatting (messages are copied raw, not rebuilt)
- each message's original received date, so the new inbox sorts correctly
- read / unread status
- PHP 7.4 or newer with the
imapextension enabled - Composer
- Both servers reachable over IMAP with SSL on port 993
git clone https://github.com/hosthobbit/imap-migrate.git
cd imap-migrate
composer installThen upload the folder (including vendor/) to a PHP-enabled web server.
- Open
index.htmlin a browser, for examplehttps://yourdomain.com/imap-migrate/. - Fill in the source server, username and password.
- Fill in the destination server, username and password.
- Click Migrate. The result is shown when the copy finishes.
This form accepts mailbox passwords and connects to whatever server it's given. Don't leave it publicly accessible. Protect the folder with HTTP authentication or an IP allow-list, always serve it over HTTPS, and remove it from the server when the migration is done.
- Copies the INBOX folder only (not Sent, Drafts or custom folders).
- Runs as a single web request, so very large mailboxes may hit PHP's
max_execution_time; raise it or migrate in batches. - The progress bar is indicative only; it doesn't track individual messages.
For large or multi-account migrations, Host Hobbit can run them for you. See below.
MIT, see LICENSE.
Built and maintained by Host Hobbit Ltd: managed WordPress hosting, WHM/cPanel and VPS administration, security hardening and AI automation for businesses in the UK.
Need help deploying this, or want something similar built for your business? Get in touch.