Backup GMAIL Messages with Python

  • Thread starter =?ISO-8859-1?Q?Gregory_Pi=F1ero?=
  • Start date
?

=?ISO-8859-1?Q?Gregory_Pi=F1ero?=

I was wondering what methods you experts would reccomend for this task?

Here are the options I have come up with so far:

1. Build something with the poblib library
(http://docs.python.org/lib/module-poplib.html)
--Any pointers on doing this? How to I get poplib to save messages in
a standard format I can
later import into Thunderbird, Outlook, etc? (mbox?)

2. Use libgmail
--How stable is this package? Does it just use screenscraping?

3. Call Fetchmail from command line?
--Does anyone know an easy way to do this? All I found was a 6 page
tutorial! yikes!

Much thanks for any advice you might have. I'm also open to options I
haven't thought of too.
 
S

Simon Forman

Gregory said:
I was wondering what methods you experts would reccomend for this task?

Here are the options I have come up with so far:

1. Build something with the poblib library
(http://docs.python.org/lib/module-poplib.html)
--Any pointers on doing this? How to I get poplib to save messages in
a standard format I can
later import into Thunderbird, Outlook, etc? (mbox?)

I don't do much with email, but there's an example of accessing gmail
via poplib here:
http://groups.google.ca/group/comp.lang.python/msg/a12263a870f5f236

And of course there's the 'email' standard library module:
http://docs.python.org/lib/module-email.html

HTH,
~Simon

Out of curiosity, why do you want to _backup_ a gmail account? (I use
my gmail account to backup files and documents I never want to lose.)
I could think of some reasons, but I'm wondering what yours are. : )
 
?

=?ISO-8859-1?Q?Gregory_Pi=F1ero?=

Out of curiosity, why do you want to _backup_ a gmail account? (I use
my gmail account to backup files and documents I never want to lose.)
I could think of some reasons, but I'm wondering what yours are. : )

Here are a few:

1. Google could turn evil someday (and delete everyones' data?)
2. Google coud lose or delete data by accident
3. You could lose your internet connection for an extended period of time
4. You may want to move to a different email software in the future
and am not able to export from Google calendar at that time(see reason
1)

Update on my question:
getmail looks like another option: http://pyropus.ca/software/getmail/
but not cross platform?

-Greg
 
N

Neil Hodgson

Gregory Piñero:
I was wondering what methods you experts
> would reccomend for this task?

While you can write a script, its quite easy to turn on POP and run
a client side mail client like Thunderbird.

Neil
 
?

=?ISO-8859-1?Q?Gregory_Pi=F1ero?=

While you can write a script, its quite easy to turn on POP and run
a client side mail client like Thunderbird.

Good point, Neil. This is a very tempting option, I just wanted to
include it in a backup script rather than having to open up
Thunderbird once a day.

-Greg
 
D

Dennis Lee Bieber

Good point, Neil. This is a very tempting option, I just wanted to
include it in a backup script rather than having to open up
Thunderbird once a day.
Well, with POP3 access, you could probably run a simple script that
just downloads all new messages without marking them read or deleting
from server...

There are a fair number of Python libraries for SMTP/POP3 access...
Since that is standard, whereas web-mail access isn't.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
C

Chris Lambacher

fetchmail worked for me. You have to be patient though because it takes a
while for all of your mail to become available for pop download.

-Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top