[kwlug-disc] How to Archiving Gmail Locally

Khalid Baheyeldin kb at 2bits.com
Tue May 8 01:05:22 EDT 2018


So, the tool I use to get mail from Gmail and save it locally is 'getmail4'
(name of package in Ubuntu).

I run it as follows, once a day from cron:

getmail -r gmail.rc

The gmail.rc file has the following:

#=== START
[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = YOUR_EMAIL_ID # without @...
password = YOUR_PASSWORD
mailboxes = ( "[Gmail]/All Mail", "[Gmail]/Sent Mail", "[Gmail]/Drafts" )

[destination]
type = Maildir
path = ~/mail/gmail/

[options]
verbose = 0
message_log = ~/mail/gmail.log
read_all = false
max_messages_per_session = 1000
received = false
delete = false
#=== END

You may need to enable that setting in Gmail that allows low grade
encryption (or was it plain text?),  forgot its exact name.

In the directory ~/mail/gmail, the script will create subdirectories called
'cur', 'tmp', and 'new'. The first is what contains your emails. The 'new'
directory contains some emails, not sure how they are different from the
ones in 'cur'.

As I mentioned, the objectives were to:

a) have a backup, and
b) find out which messages take the most space and delete them from Gmail

The first one is achieved, but all the messages are in one directory, one
file each. So they are not sorted in any useful order nor by Gmail Label or
date or anything.

They are searchable by grep and friends though, and size can be determined
via ls (but that will just give you a list of cryptic file names, and you
have to use less or something to look inside it).

You can point something like mutt to the directory, but not sure how the
performance will be.
-- 
Khalid M. Baheyeldin
2bits.com, Inc.
Fast Reliable Drupal
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- anonymous
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20180508/166d2a53/attachment.htm>


More information about the kwlug-disc mailing list