The Email Backup Tool is a Python script for backing up emails from an IMAP mailbox to the local file system. It provides a convenient way to create backups of emails stored on an IMAP server.
- Connects to an IMAP mailbox server securely using SSL/TLS.
- Retrieves a list of available mailbox folders.
- Creates local backup folders for storing email backups.
- Fetches and stores emails by their IDs.
- Displays progress bars using tqdm library.
- Gracefully handles interruptions (e.g., Ctrl+C) during the backup process.
- Clone the repository:
git clone https://github.com/ludndev/tool-backup-emails
- Install the required dependencies:
pip install -r requirements.txt
Prepare a CSV file named accounts.csv
containing email account details (email, password, server, port) in the root directory.
The Email Backup Tool supports the following command-line options:
-h, --help
: Display the help message and exit.--zip ZIP
: Specifies the maximum size in MB for each archive.--backup BACKUP
: Specifies the path of the backup folder. (Default:backups
)--account ACCOUNT
: Path of the CSV file containing account information.--email EMAIL
: Email address of the account to be backed up.--password PASSWORD
: Password of the email account.--server SERVER
: IMAP server address for accessing emails.--port PORT
: Port number of the IMAP server.
To run the script with custom options:
- Backup emails with default settings:
python email_backup_tool.py
- Backup emails with a custom backup folder:
python email_backup_tool.py --backup /path/to/backup/folder
Replace /path/to/backup/folder
with the desired destination folder for storing backups.
- Backup emails with a custom accounts source file:
python email_backup_tool.py --account list_account.csv
- Backup emails on single account:
python email_backup_tool.py --email example@example.com --password my_password
- Display help message:
python email_backup_tool.py -h
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them to your branch.
- Push your changes to your fork.
- Submit a pull request to the main repository.
- Improve eml file naming
- Add args
- Make zipping optional
- Write tests
- Skip downloaded mail
- Backup single account using cli arg
- Allow file format choice
- Clean directories after zipping
- Restore to remote server
- Use multi threading
This project is licensed under the MIT License. See the LICENSE file for details.
- This project was created by Judicaël AHYI.
- Email Backup Tool uses the tqdm library for displaying progress bars.