Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-15-2009, 08:48 PM   #1
LQ Newbie
Registered: Jun 2007
Posts: 22

Rep: Reputation: 16
Downloading old gmails with getmail (or tell me another way)

I use getmail for two gmail accounts and it works flawlessly for getting new emails. Now I want to download certain emails that have been read (i.e. not new unread mail) from another account. I found an article showing how to do this (here), but the getmailrc file the site shows is exactly the same as the one I use to get new emails. I set it up for this other account and, sure enough, it only gets new mail and doesn't download the messages I want.

I tried marking the emails I want to download as unread and ran it again, but it downloaded nothing.

I tried with "getmail -a -r" and with just -r. (a=download all messages, r=specify getmailrc to use)

I tried deleting
~/.getmail/gmail.log and
~/.getmail/ but that had no effect.

The emails I want in gmail are labeled. When viewing them on, it appears as if they are put in a subfolder of the inbox, but I don't know if they actually are. However, I tried adding different mailboxes to the getmailrc and even moving the email to the inbox, but nothing worked.

How can I get those emails that have been read from gmail to my hard drive? I don't have to use getmail, but now it's bugging me and I want to know how to beat getmail at this game.

This is my getmailrc

type = SimplePOP3SSLRetriever
server =
username =
password = mypass

#neither of these work
#mailboxes = ("INBOX")
#mailboxes = ("label")

type = Maildir
path = ~/Mail/

verbose = 2
message_log = ~/.getmail/gmail.log
Old 10-16-2009, 01:17 AM   #2
Registered: Nov 2001
Location: US
Distribution: Slackware 14.2
Posts: 368

Rep: Reputation: 110Reputation: 110
On the Gmail website, you have to select the "Enable POP for all mail (even mail that's already been downloaded)" option. Google doesn't (apparently) have a way to selectively mark files for re-download. I just went through this process a couple weeks ago and had to download a few thousand old emails and then delete the duplicates (thank god Mutt makes deleting duplicates easy). It also may take multiple getmail download sessions to retrieve all your mail, depending on how many emails you have on Gmail.
Old 10-16-2009, 05:52 PM   #3
LQ Newbie
Registered: Jun 2007
Posts: 22

Original Poster
Rep: Reputation: 16
Thanks. I think the Gmail option was the problem. It said POP was available for all email sent since June, which must be when I enabled it. I selected POP for all mail and now it's downloading 545 emails. I only want 55 emails but I can dig those out as long as it downloads them.

I never would have guessed that would be an option, but I guess it makes sense now that I think about it.
Old 10-16-2009, 06:59 PM   #4
Registered: Mar 2009
Distribution: CentOS - Ubuntu - Debian
Posts: 83

Rep: Reputation: 27

An option that may work is to access your account using imap, that way
you will have access to the "labels" in your mail like folders.

I run a test and works fine, I am using Thunderbird to backup my email,
I was able to do a search for email between specific dates, move that
to Inbox and then access the account from Thunderbird and copy those
emails to my local drive.

Instead of move the emails to Inbox you can create a new label for them
and apply to all results in your search

Best regards,
Old 10-16-2009, 09:40 PM   #5
LQ Newbie
Registered: Jun 2007
Posts: 22

Original Poster
Rep: Reputation: 16
Thanks. I considered doing that but I don't have any experience with IMAP and this was a one time thing which I knew should have been working.

I was able to download them and write a short script to move the 55 emails I wanted to a directory to do other things with them.

for i in *localhost
cat $i | grep "From: XX"
then mv $i /folder


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
getmail prashantbhushan Linux - Server 7 06-02-2007 07:56 AM
Can I do this with Getmail? FreeDoughnut Linux - Software 0 03-25-2007 04:22 PM
Getmail exvor Linux - Software 3 03-31-2005 09:28 PM
problems with the LaCie 4x USB external cd-writer | Gmails ? Youssef_C Linux - Hardware 0 01-27-2005 08:48 AM
Free Gmails in Gmail Thred keysorsoze General 1 01-25-2005 01:11 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration