Convert maildir to mbox

Note, there is a short story before the main course.

I recently had a customer leave. It’s never good to lose a customer. They left not because of any service issues but because its hard for them to understand that I am not a web designer. I provided hosting service for them, and I tried to make it clear that they should find a web desinger and someone to maintain their site because that is not something I specialize in or have any interest in doing. At any rate this of course leads to them finding a designer who wants to move their site to some other host. I have no problems with that whatever makes the maintainer happy since he is the one who will have to support it.

My issue comes when I am asked to handle things like mail. The webdeveloper seems to not understand how mail works and appears to not be comfortable with migration. I reminded the customer to make sure he had a plan in place for their mail (it’s not my responsibility). I switched the dns on my end and changed the nameservers with the registrar so the cut would be as quick as possible. Days later after sorting the mail issue on their end I was asked about their old email. I had just the day prior terminated their accounts so I had to dig through some backups to find the mail. I obliged and sent a tar.gz of the entire maildir. Now their new guy says he isnt comfortable restoring the mail probably because he has no clue how to deal with maildir on the new host (network solutions). Mind you I am taking some liberty here because he complained to me I didnt tell him how to migrate the mail. I had just assumed he would use a tool like imapsync or even hook up both accounts in a mail client and manually transfer the mail from the old server to the new one. So that being the case I say he doesn’t understand how mail works, and its his fail for accepting responsibility to migrate a site and hosting services without planning how to do so.

That brings us to the main course or as I look at all the text above perhaps it should be desert.

I converted the maildir to mbox for the customer in the hopes the new guy can figure out how to load the mbox into a mail client and upload the mail to the new server for the customer. Perhaps I am being a bit petty making him do it. I don’t feel too bad I have already gone way past normal customer service with this customer, and even gave them several months of hosting for free (I forgot to bill them and told them not to worry about it). Not to mention the time I have spent going to their office to troubleshoot a workstation because “the internet was broken” which I also did not charge for. So maybe I am just inflicting a bit of pain on the new guy, but I hope he learns from the experience.

So how did I convert the maildir to mbox? I used formail which is provided by procmail.

for i in maildir/cur/*;do formail -I "Status: RO" <"$i" >>mbox;done
for i in maildir/new/*;do formail -I Status: <"$i" >>mbox;done

You will want to do that for each maildir (don’t forget the .Subfolder directories). And remember each “folder” or maildir would be a different mbox file. So if you wanted to save sent mail as well …

for i in maildir/.Sent/cur*;do formail -I "Status: RO" <"$i" >>sent;done
for i in maildir/.Sent/new/*;do formail -I Status: <"$i" >>sent;done

2 Comments

Leave a Reply

Your email is never shared.Required fields are marked *

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha