

GitHub - joeyates/imap-backup: Backup GMail (or other IMAP) accounts to disk
source link: https://github.com/joeyates/imap-backup
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

imap-backup
Backup GMail (or other IMAP) accounts to disk
Installation
$ gem install 'imap-backup'
Commands
For a full list, run
$ imap-backup help
For more information about a command, run
$ imap-backup help COMMAND
Setup
In order to do backups, you need to add accounts via a menu-driven command line program:
$ imap-backup setup
GMail
To use imap-backup with GMail, you will need to enable 'App passwords' on your account.
Folders
By default, all folders are backed-up. You can override this by choosing specific folders.
Configuration file
setup
creates the file ~/.imap-backup/config.json
E.g.:
{ "accounts": [ { "username": "[email protected]", "password": "secret", "local_path": "/path/to/backup/root", "folders": [ {"name": "[Gmail]/All Mail"}, {"name": "my_folder"} ] } ] }
It connects to GMail by default, but you can also specify a server:
{ "accounts": [ { "username": "[email protected]", "password": "secret", "server": "my.imap.example.com", "local_path": "/path/to/backup/root", "folders": [ {"name": "[Gmail]/All Mail"}, {"name": "my_folder"} ] } ] }
Connection options
You can override the parameters passed to Net::IMAP
with connection_options
.
Specifically, if you are using a self-signed certificate and get SSL errors, e.g.
certificate verify failed
, you can choose to not verify the TLS connection:
{ "accounts": [ { "username": "[email protected]", "password": "secret", "server": "my.imap.example.com", "local_path": "/path/to/backup/root", "folders": [ {"name": "[Gmail]/All Mail"}, {"name": "my_folder"} ], "connection_options": { "ssl": {"verify_mode": 0}, "port": 993 } } ] }
Security
Note that email usernames and passwords are held in plain text in the configuration file.
The directory ~/.imap-backup, the configuration file and all backup directories have their access permissions set to only allow access by your user. This is not done on Windows - see below.
Windows
Due to the complexity of managing permissions on Windows, directory and file access permissions are not set explicity.
A pull request that implements permissions management on Windows would be welcome!
Run Backup
Manually, from the command line:
$ imap-backup
Alternatively, add it to your crontab.
Result
Each folder is saved to an mbox file. Alongside each mbox is a file with extension '.imap', which lists the source IMAP UIDs to allow a full restore.
Local commands
There a various commands for viewing local backup status.
To view the list, use
$ imap_backup help local
Troubleshooting
If you have problems:
- ensure that you have the latest release,
- turn on debugging output:
{ "accounts": [ ... ], "debug": true }
Restore
All missing messages are pushed to the IMAP server. Existing messages are left unchanged.
This functionality requires that the IMAP server supports the UIDPLUS extension to IMAP4.
Other Usage
List IMAP folders:
$ imap-backup folders
Get statistics of emails to download per folder:
$ imap-backup status
Design Goals
- Secure - use a local file protected by permissions
- Restartable - calculate start point based on already downloaded messages
- Standalone - do not rely on an email client or MTA
Documentation
Recommend
-
22
With the new year upon us, I decided it was time to do something ambitious for my Open Source project. This is where I normally quip about never mentioning my project before, even though I literally always do. A new year...
-
22
Recently, I had some issues with my email provider and it gave me a bit of a scare as I realized that I had taken email for granted and did not have a backup in case things went south. Since my email address is run off of...
-
11
渗透基础——利用IMAP协议读取邮件 22 Jan 20210x00 前言 在渗透测试中,当我们获得了用户的邮箱凭据,需要对邮箱内容进行分析时,可以选择通过IMAP协议实现自动化来提高效率。 本文以Exchange为例,介绍通过IMAP协议下载邮件...
-
16
Sending IMAP commands using php advertisements I'm trying to access yahoo mail IMAP server with a php script. I read that yahoo requires a spe...
-
6
【程式範例】使用Gmail IMAP讀取信件 2011-01-18 05:59 AM 26 27,528 工作上有從Gmail讀信取出附檔的需求,先前在點部落
-
8
What Google protocol does it use for Gmail? (not IMAP or POP) advertisements You can access gmail either using the web interface, Google's And...
-
13
如何正确设置QQ邮箱IMAP服务 2021年10月20日 132点热度 0人点赞...
-
4
How to Retrieve Emails Using IMAP in Python I am FSD (Full-stack developer) and I have expertise with Angular ,PHP, Node JS, Laravel, Codeigniter and front end. Location...
-
21
Imap_search () unknown search criteria & ldquo; OR & rdquo; advertisements Trying to build a IMAP Search query to filter...
-
2
The Difference between POP3 Vs. IMAP EmailsThe Difference between POP3 Vs. IMAP EmailsWhen it comes to retrieving email messages, you have to do it right. To regain your emails, you need to be intentional which the method you pick on...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK