0

I have backup folders of emails that I downloaded from an old server running Exim. I can open all the files in a text editor and read the contents and they are in standard RFC 822 format.

The filenames look like this:

1284775865.H451571P15783.pre.press-themes.com,S=840363/2,S

Ultimately I need to import them into a Google Apps account. It's a free account so I can't use the python apps API method which would work if I added a .txt file extension. Google has Mac Email Uploader but it requires the email to be in one of the following:

  • Apple Mail: ~/Library/Mail
  • Eudora: ~/Eudora Folder -Thunderbird: ~/Library/Thunderbird

When I try to import the messages into Apple Mail or Thunderbird they are not recognized. I have tried adding a .mbox file extension and a .txt file extension. I have also ran this bash script but it converted them all into one big file with a .mbox extension that can't be read by any of the clients.

#!/bin/bash
if [ $# == 0 ]; then
echo usage ${0##*/} FolderName
exit 0
fi

for file in `find "$1" -type f`; do
   mbx="${file%/*}.mbox"
   mbx="${mbx//\//_}"
   cat "$file" | formail >> "$mbx"
    done
1
  • 1
    Looks like standard Maildir filenames - could you install a pop server like Dovecot, drop the files into you Maildir/new folder and then point Google apps at this (temporary) mail server to grab the mails?
    – barryj
    May 6, 2011 at 21:48

1 Answer 1

1

According to the page you linked to,

The Google Email Uploader for Mac is a desktop utility for Mac OS X that uploads email archives from Apple Mail, Eudora, Thunderbird, and exported Entourage mail (along with other mbox and Maildir archives) to your Google Apps mailbox.

What you have is Maildir, but from your given example it seems the names have been mangled during the transfer: the 2,S suffix is supposed to be separated by a : (or ; in some systems), not by /.

The output of your mbox conversion script should be accepted directly by Uploader, too.

dir="${1%/}"
mbox="$dir.mbox"
find "$dir" -type f | while read name; do
    formail < "$name" >> "$mbox"
done
1
  • It worked adding the entire Maildir folder that included all the mailboxes.
    – Chris_O
    May 8, 2011 at 5:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .