[kwlug-disc] How to Archiving Gmail Locally

Jeff Smith crankyoldbugger at gmail.com
Tue May 8 09:35:45 EDT 2018


That was a good meeting last night.  Some good speakers and some swag to
boot...  Also nice to see so many new faces last night.

This is a good script, Khalid.  I've been doing this process more or
less manually, and at random times, by going into Thunderbird,
downloading any over-large folders to the local client, then zipping up
the resulting .eml files and storing them on my own backups server. 
While it's considerably more work than your script, it does allow me
some leeway in what folders I clean up (i.e. do I want to keep this
year's stuff online, can I break larger folders down by years, etc.)

Maybe once I get my manual process to the point where your script can
take over, I can give the impression of being much more organized...



On 2018-05-08 01:05 AM, Khalid Baheyeldin wrote:
> 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 <http://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 <http://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
>
>
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20180508/0f75bb3d/attachment.htm>


More information about the kwlug-disc mailing list