INTRODUCTION
gmail_archiver.php is a small PHP script able to download all messages from a
given IMAP server.
REQUIREMENTS
* Operating system: GNU/Linux
* Packages: php5-cli php5-imap
LICENSE
gmail_archiver.php is released unter the conditions of the WTFPL license
without any warranty. See LICENSE file for more details.
INSTALLATION
Depending on how you obtained it copy or extract gmail_archiver.php into a
directory you have write access to.
USAGE
Go to the directory where you want to download your mails by issuing a cd
command in a command line shell, run the script and enter the data needed to
connect to Gmail (or other email service) via IMAP. Example (assuming that
you have put gmail_archiver.php into your home directory):
~$ mkdir my_mails
~$ cd my_mails
~/my_mails$ php ~/gmail_archiver.php
Server: imap.gmail.com
Port: 993
Account name: [email protected]
Password:
(Note: when you type your password it will not be displayed on the screen.)
The script will create a directory named after your account name in the
directory where you are running it. Inside that directory subdirectories will
be created according to your IMAP folders. You will find your mails in those
subdirectories after the script terminates.
Example:
~/my_mails$ find
.
./[email protected]
./[email protected]/INBOX
./[email protected]/INBOX/1234.txt
./[email protected]/INBOX/1235.txt
./[email protected]/INBOX/1236.txt
./[email protected]/a_label
./[email protected]/a_label/1.txt
./[email protected]/a_label/2.txt
./[email protected]/another_label
./[email protected]/another_label/42.txt
./[email protected]/another_label/43.txt
You can run the script automatically if you specify connection parameters
in the arguments.
~/my_mails$ php ~/gmail_archiver.php help
Usage: php gmail_archiver.php [IMAP server [port [account name [password]]]]
Note: be careful when running the script this way as your password might be
recorded into your bash history, etc. Specify your password in the command
line only if you are sure you know what you are doing!