I remember about 20 years ago writing a relatively simple tool in perl with IMAP::Client to migrate a Universities staff mail from Courier (I think) to Communigate Pro, and then another one to migrate from Communigate Pro to Microsoft Exchange a few years later.

I was at the beginning of my career. It was pretty easy. Went almost flawlessly, moving thousands of peoples email.

Where is the "painful" part? It's just moving blobs of text around.