Recover emails from a full backup of /home?

Hello,

After a clean reflash of 4.2 on a Xperia X, I would like to restore the emails I had ( to have them handy, rather than on my PC).
I have restored the ~/.qmf (database, files, etc) and ~/Downloads/mail_attachments from the copy I have made before reflashing (full copy of /home made in recovery mode)
For some reason the email app seems to disregard that content and starts empty.
Any magic to “bind” the email app onto the old data?

Most probably because you are missing the account itself?

.local/share/system/privileged/Accounts/libaccounts-glib/accounts.db

Maybe try to create that account aforehand via GUI (or copy above folder as wel?) and then copy over all .qmf stuff again?

Accounts are there (restored from SFOS backup).
Just that old emails do not appear in the folders (Inbox, Sent… etc)
I suppose I must do that while in recovery mode to avoid interferring with active components/services and their inherent file locks in a “live” session. Or do you know what are the services I’d have to stop?

Oh, okay.

And yes, I assumed you checked the copy back output? And there were no errors?
(in general this should work, did this back in the days on N900, but never on SFOS)

But after restoring the backup and the accounts recreated the old mails should be there as well already!?
Are you sure your account works? Can you connect/retrieve/send mail? After restoring one needs to re-enter passwords…

And another thing: are you starting mail from GUI or from CLI (which would definitely not show any accounts/mails due to sandboxing).

the old mails should be there as well already!?

As disappointing as it can be, emails themselves are out of scope, and that’s ok according to this.

Are you sure your account works? Can you connect/retrieve/send mail? After restoring one needs to re-enter passwords…

Yes, all that works - sending, receiving ( after reentering the passwords).

are you starting mail from GUI

Yes

1 Like

That is a bummer.
Imagine you have a POP account (all mails deleted from server)!

Sorry then.

That is a bummer.

Indeed. Emails are on my main PC, so they’re not entirely lost. I even have their useless copy in my old qmf folder :wink:
But yes, emails are removed from the server ( I don’t like leaving them on the providers’s server for IMAP access, in case there’s a breach or anything like that).

Sorry then.

Thanks :slight_smile:

If it’s a SQLite db, I will try to look at the db structure and content - maybe I can merge them somehow.

1 Like

First I would try to copy back in recovery mode…
(much easier testing approach before diving into db structure)

Oh, and as writing: maybe it is related to the sequential numbering of accounts (possibly used from accounts.db as index/foreign key inside email store.db). Just a wild guess…
Godd luck (and let us know! :slight_smile: )

Will try to find some time this week and revert here if I spot anything.

As for the sequence - valid point. I will look into ( although accounts are restored from a “official” SFOS backup only few minutes distant from the /home backup - so they are supposedly consistent ).

If anyone has some insights on how the two ( accounts, mail) db work together , I’d be glad to hear from you ( even if the information is subject to change in future releases and so).