IMAP Email Backup
smalldata.tech
smalldata.tech
Have used it at pretty massive scale and it handles a hell of a lot of different options.
I wrote my own thing using IMAPclient in python and it was a hundred times quicker.
https://medium.com/@buro9/one-account-all-of-google-4d292906...
...telnet to the same host:port on same machine works fine.
>./imapgrab.py -d -v -f ~/user@email.com -s imap.mail.server -S -p 993 -u user@email.com -p password -m "_ALL_,-INBOX.Trash,-INBOX.Spam,-INBOX.Junk,-Trash,-Junk,-Spam"
I was moving mail from a Gmail account to a Gandi account about a year ago, before the recent spurt of development activity on Thunderbird.
Copy folders then?
Always copy, verify that the messages really are at the destination, then delete. I don't know why this isn't what Thunderbird does on its own when you move mail, but it isn't.
getmail
once in a while.Not sure how much work has been done on Thunderbird but I do an IMAP backup before archiving or making structural changes.
I should probably have an automated download for backup purposes set up ...
Thunderbird would start do it's things (moving emails for example) then freeze for a while and then all of a sudden stop in the middle of the operation complaining that it's a lot of work and asking me if I want to continue.
It's enraging every time. More so if you consider that IMAP is not transactional afaik.
The message IDs are mostly permanent, but the rfc says they can change so clients have to test them as per connection.
This means every time you check your mail with an IMAP client it's syncing some of the headers for every message.
Every year I try and fail.
This year with the comments herein I again tried and get invalid credentials error with my Gmail.
1) Used mutt/getmail/python script ( password is correct verified it )
2) Even changed password and still same issue
3) I also tried to enable less secure apps to access email option in google settings. But keep getting the Authentication error. Can someone please point me to a good note on how to get Authentication error sorted ( maybe more to take care of ) ( I use ubuntu bionic , python 2.7.17, getmail 5.5 )
Error rahu@rahu:~/0del/_working/_backupEmail$ ./ss.sh IMAP Grab 0.1.4 --- List option selected Connecting to IMAP server via SSL Logging into IMAP server Traceback (most recent call last): File "./imapgrab.py", line 444, in <module> imapgrab() File "./imapgrab.py", line 150, in imapgrab ig_list = IG_list_mailboxes(ig_options) File "./imapgrab.py", line 193, in IG_list_mailboxes ig_imap.login(ig_options.username,ig_options.password) File "/usr/lib/python2.7/imaplib.py", line 523, in login raise self.error(dat[-1]) imaplib.error: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
https://github.com/jay0lee/got-your-back
It's created by the developer of GAM - a popular tool you may have heard of, for managing G Suite.
Turning on 2FA and using Google's "app-specific password" eliminated errors of this sort for me recently.
I get along well with a tool called offlineimap[1] though it's python2; you can even use it to sync imap backends[2]. I use it simply to populate a Maildir on my machines.
Sadly I have not found it to work with office365 (then again, what does other than outlook and thunderbird's proprietary subscription based extension?).
[0]: shameless plug: https://blog.dijit.sh/importance-of-self-hosted-backups
Ones I've tried:
fetchmail
sylpheed-claws
evolution
mutt
The relevant section of my .offlineimaprc (trimmed for brevity, edited for privacy):
[Repository remote]
type = IMAP
remotehost = outlook.office365.com
remoteuser = "user@university.edu"
remoteport = 993 ~ $ offlineimap
OfflineIMAP 7.3.2
Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.101 (bundled), Python v2.7.18, OpenSSL 1.1.1g 21 Apr 2020
Account sync work:
*** Processing account work
Establishing connection to outlook.office365.com:993 (work-remote)
Enter password for user '<user>@massive.se':
PLAIN authentication failed: AUTHENTICATE failed.
LOGIN authentication failed: LOGIN failed.
ERROR: All authentication types failed:
PLAIN: AUTHENTICATE failed.
LOGIN: LOGIN failed.
*** Finished account 'work' in 0:11
ERROR: Exceptions occurred during the run!
ERROR: All authentication types failed:
PLAIN: AUTHENTICATE failed.
LOGIN: LOGIN failed.
Traceback:
File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 293, in syncrunner
self.__sync()
File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 369, in __sync
remoterepos.getfolders()
File "/usr/lib/python2.7/site-packages/offlineimap/repository/IMAP.py", line 452, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/python2.7/site-packages/offlineimap/imapserver.py", line 586, in acquireconnection
self.__authn_helper(imapobj)
File "/usr/lib/python2.7/site-packages/offlineimap/imapserver.py", line 459, in __authn_helper
"failed:\n\t%s"% msg, OfflineImapError.ERROR.REPO)https://github.com/poundifdef/gmail-deleter
The next step would be to have it save and archive email threads. (Would this be useful to anyone?)
https://en.wikipedia.org/wiki/Third-party_doctrine
Thanks to the third-party doctrine, messages stored on the provider can be disclosed to the government without a warrant. Your emails have contact history, location histories, attachments, plans, all sorts of stuff.
Don't leave it on the server, where it's available for the taking. Even a password breach will deliver the entirety of it to an attacker.
Important documents like tax info etc, are obviously kept for the minimum legal period but then again they don't take up all that much space.
I've been doing this for around 10 years now and so far I have not had any problems with missing old stuff, _touchwood_.
Long story short, just delete stuff you don't need altogether, makes backups a breeze and frees you from worrying about hackers exposing your musings from when you were a teenager :)
Also:
nostromo:~/Pictures$ du -sh LightroomMasters
1.5T LightroomMasters
nostromo:~/Pictures$ find LightroomMasters -type f | wc -l
207655
nostromo:~/Pictures$ ls -1d LightroomMasters/* | sort -n | head -1
LightroomMasters/1997
nostromo:~/Pictures$
I've been taking photographs of events in my life for a long time, and I look at them regularly, which brings me joy. Sometimes I send loved ones photos I took of them 3, 5, 10, 15 years ago that they've never seen, and it brings them joy as well.There are different paths, and digital minimalism is only suitable for a subset of the population. Many of us derive immense value from having high fidelity records of our lives and the lives of those close to us.
Also, if you store your historical data for a long time, you can do super cool shit like this: https://writings.stephenwolfram.com/2012/03/the-personal-ana...
[1]: In case you can't tell, this happened to me.
That being said, if you go on and set up getmail, I'm not sure what's the point to continue to use mutt through imap (the author mentions decrypting the archive before reading them, so I assume it's not their daily driver and they keep using direct imap connection otherwise). Imap is still useful if you want to read mails on your mobile.
For the encryption part, I found cryfs [1] to be very useful. It's a fuse based app that encrypts files on the fly as they are written to the pseudo fs and stores them in partioned small size encrypted files. Basically, it means you can use the pseudo fs as a regular directory, store your mail in it and read them from it, and then the special layout of the encrypted directory with its small files is especially rsync-friendly (outside of email system, if I store a big file where only a small part has changed, only the files related to these small changes will be uploaded).
An other advantage of going full local : you can use notmuch [2]. It's a mail indexer that allows fast and advanced search within mails. I have all my mails since 2013 locally, and it takes less than a second to make a full text search within them.
The last thing that I love is the ability to use maildrop [3]. It's regexp based filtering and can forward the mail to anything (mailbox or program), so it allows to have advanced filters that can do quite crazy things (my phone sends me mails when my battery is depleted or fully charged, and it triggers desktop notifications on my computer). Not to be abused, obviously. Don't allow anyone to shut down your computer by sending a email :)
Second: the button on the article to submit to HN seems to be somewhat... off? I wouldn't mind one that would submit in the first instance and then link to the HN thread on subsequent clicks but having a button that just loads a round into the chamber for all users clicking on it seems like incitement to blogspam.
Regarding the submit to HN button: if the article has already been posted, HN will itself just link you to it rather than make a new submission. So it is a bit of an intelligent hack where it piggybacks on HN's own code, hope that assuages you :)
Haha, it does actually. That is very cunning!
I've maintained https://github.com/rcarmo/imapbackup since 2013 (and used early versions of it for years before that), so feel free to try it out and see if it fits your use case (mine was snapshotting existing IMAP mailboxes into mbox format, which was what we could use for migrating mailboxes across systems then, and also fit my personal use case for backups).
The feature set is likely to appeal to many HN users:
* ZERO dependencies. (other than Python 2.5 or higher)
* Copies every single message from every single folder (or a subset of folders) in your IMAP server to your disk.
* Does incremental copying (i.e., tries very hard to not copy messages twice).
* Tries to do everything as safely as possible (only performs read operations on IMAP).
* Generates mbox formatted files that can be imported into Mail.app (just choose "Other" on the import dialog).
* Optionally compresses the result files on the fly (and can append to them).
* Is completely and utterly free (distributed under the MIT license).
If any Googler is reading this, why oh why is muting not part of the API?
If you use rsync through ssh, I would say that's a very good option, if anything because on your server, you only need ssh to be exposed to the internet rather than ssh + an imap server. Given how servers are constantly attacked, this is way safer.
In addition to imap -> filesystem backups it supports synchronizing mail in both directions. And both source and destination can be remote systems.
If you launch something like fetchmail or imapsync at it, it will close the connection in the middle of the sync because you're doing something nasty in his opinion.
Last time I switched jobs and had to download 18+ GB of emails it took me days to download them all off office 365, and I was to run it in a while true loop in screen. Luckily I didn't wait for the last day to start downloading my emails.
And also luckily, your company didn't sue you or try to have you arrested for extracting 18+ GB of company property.
I mean: my colleagues and I faced countless issues, we had both problems and celebrations, and I want to be able to remember all of that in the future.
My goal is to make it simple enough for my grandpa to use it. However, I'm still not there yet. Let me know what you guys think.
Contact wraps to the next line
I made a separate thread here: https://news.ycombinator.com/item?id=23425995
The fact that they are marked as unread from other machines is a pain, but not insuperable.
Python 2 has a very, very long tail.