Atozed Forums

Full Version: Use IMAP to copy/verify folder on another server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I am trying to retire my home-based Windows Server on cost grounds, which contains a Communigate Mail server. This is a relic from the pilot system I had at home to model the school system I set up. I have now retired and need to dispose of the pilot which still contains domestic stuff. I have set up my email under Microsoft Family 365, and this sends and receives new emails to my existing email address OK. It has a generous 50GB mailbox per user, so I can also save my TB archive folders there.

I tried to use Thunderbird to drag and drop the pre-existing emails one folder at a time to the new server. This sort-of worked. I assume some sort of magic happens which enables the transfer between IMAP accounts without actually sending emails. I discovered that there are quite a few emails missing, and trying to copy many in one go just doesn't work reliably.

So here's my proposal? Is it viable? Are there traps to look for? Getting TB to work with 365 involved an app-specific password; I assume something similar is needed.
  • Write a Delphi program (I have a real 7 and a community 10.3) and use Indy10 IMAP to read the emails on the 365 server, and build a MySQL database with just the message-id as key so I know what's on the new one. There aren't too many there yet, and nothing new happens on the old server.
  • Then read the messages on the old IMAP server and ignore ones with a message-id matching that on 365, which means they copied OK.
  • For the missing ones, copy the email from the old one to the new one, one at a time - presumably with IMAP component, not sure exactly how - and check if it failed, presumably with an Indy error indication, then try again after an interval.
I am hoping I can make this fairly automatic. It doesn't matter if it's slow.

Regards
Ken
(05-08-2022, 12:39 AM)ArnoldGoat Wrote: [ -> ]I assume some sort of magic happens which enables the transfer between IMAP accounts without actually sending emails.

IMAP is a mailbox management protocol, not an email delivery protocol (that is why you need a separate SMTP connection to send emails). IMAP has commands for adding emails to folders, copying/moving emails between folders, etc. Transferring an email between IMAP accounts is simply a matter of downloading the email from one account and then adding it as-is to a folder in the other account.

(05-08-2022, 12:39 AM)ArnoldGoat Wrote: [ -> ]I discovered that there are quite a few emails missing, and trying to copy many in one go just doesn't work reliably.

Then you should contact Mozilla about that. Maybe it is a bug in Thunderbird, or maybe it is a bug in the target server, or maybe there are errors being reported in the IMAP exchange. Who knows. There is not enough information to go on.

(05-08-2022, 12:39 AM)ArnoldGoat Wrote: [ -> ]So here's my proposal? Is it viable?

Sounds fine to me.

(05-08-2022, 12:39 AM)ArnoldGoat Wrote: [ -> ]Getting TB to work with 365 involved an app-specific password; I assume something similar is needed.

Probably so, yes.