Pages

Modnet Information Security Research Group

Search This Blog

Loading...

Backup emails from Gmail on Linux

Getmail is a retrivial agent implemented in python , it can use POP3 , IMAP4, it is a free software

Here are some simple steps to configure getmail using POP3 to backup emails from gmail
Getmail can be find at Pyropus dot ca or  Sourceforge dot net
It can be also implemented on repositories in different linux distribution
On Debian based can be installed using apt-get
apt-get install getmail4
Requires enabled POP on Gmail
To store mails in Unix/Linux can be used some different formats like Mbox 
or Maildir 
Here i will use Maildir where each email will be kept in a different file with an unique name

It  will require to create some new directory in our home directory
In the first directory will be stored all the configuration  data 

mkdir ~/.getmail
It wil also require a directory for emails

mkdir ~/gmail-archive && cd ~/gmail-archive/ && mkdir tmp new cur
Create the configuration file in~/.getmail

nano ~/.getmail/getmail.gmail
With this code:

[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = name@gmail.com
password = password

[destination]
type = Maildir
path = ~/gmail-archive/

[options]
# print messages about each action (verbose = 2)
# Other options:
# 0 prints only warnings and errors
# 1 prints messages about retrieving and deleting messages only
verbose = 2
message_log = ~/.getmail/gmail.log

Run getmail to download emails
getmail -r /home/user/.getmail/getmail.gmail
-r -->  this option will load the configuration from file 
This work can be also automated by creating simple script in BASH using also crontab

No comments:

Post a Comment

Recent posts