geek and proud archives |
Tuesday, September 28, 2004
gMail import
I’ve been looking for a way to get all my old e-mail into gMail for a while now. I tried out =http://www.marklyon.org/gmailGML[/url] and gExodus, but neither of them worked quite right for me. I couldn’t get GML to run (though I didn’t try all that hard), and gExodus would keep aborting after sending the first 17 messages. I also tried using =http://www.aaltonen.us/archive/2004/04/26/tip-batch-forward-emailpine[/url] to forward it, but that didn’t work right either. So, I finally gave up, and did it myself. It was surprisingly easy, and I should have just done it this way in the first place. First, I created a procmailrc file that looked like this: VERBOSE=off
PMDIR=$HOME/.procmail #Get the subject # SPAM STUFF :0: :0fw :0 Then, I just ran: cat old_archive | formail -Y -s procmail procmailrc. That’s it. formail splits the mbox file, and runs each one through procmail, which adds [old] to the subject, and forwards it along to gMail. Nice and simple. It even runs all my old stuff through my current spam filter, which catches a lot of stuff that was still lying around. Updates: It didn’t work quite right the first time. It was merging some messages together, and doing weird stuff. The -Y option to formail fixes that, at least with my mbox file. Also, it goes MUCH faster if I disable the spamassassin stuff, so that’s what I’m doing the second time around. I’ll let Google catch the spam for me. |
||||
|
I have tried using your script and get this warning:
procmail: Suspicious rcfile “/fuse1/56/gte339f/procmailrc”
procmail: Couldn’t read “/fuse1/56/gte339f/procmailrc”
here is the modified script. Any help is very much appreciated
VERBOSE=off
PMDIR=$HOME/.procmail
PATH=$PATH:$HOME/local/bin/
LOGFILE=$PMDIR/log-forward
#Get the subject
#Discard some dangerous special chars + any leading and trailing blanks
SUBJECT=`formail -xSubject:
| sed -e ‘s/[;`]/ /g’
| expand | sed -e ‘s/^[ ]*//g’ -e ‘s/[ ]*$//g’`
# SPAM STUFF
:0fw
|/usr/bin/spamassassin -c /usr/share/spamassassin -p $HOME/.spamassassin/user_prefs
:0:
* ^X-Spam-Status: Yes
/dev/null
:0fw
|formail -I”Subject: [old] $SUBJECT”
:0
dbnicol@gmail.com
Is there a way to make this work with Maildir format?
Worked for me like a charm, I’m glad to have found a bash script which dealt directly with unix email capabilities. I’m used to working with Postfix and maildrop, so seeing how you used procmail here was cool.
[…] http://www.geekandproud.net/archives/2004/09/28/497/gmail-import/ […]