AquaMail Forum

English - Android => How do I... => Topic started by: TheHippoMan on June 23, 2025, 12:45:49 am

Title: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: TheHippoMan on June 23, 2025, 12:45:49 am
I'm running AquaMail 1.55.1 on my stock Android 14 device. All the email accounts that I'm using under AquaMail are utilizing IMAP.

Using a different IMAP client (not AquaMail), I accidentally deleted a lot of emails from some of my accounts on the IMAP server, and I didn't realize it until I had synced those accounts under AquaMail. So, of course, after those AquaMail syncs, the emails deleted from the IMAP server disappeared from each of those AquaMail accounts' Inbox, as expected.

I had taken a full AquaMail accounts backup the day before, and the AquaMail.accounts.backup file was indeed properly saved in my Android /sdcard/Download folder.  So, in an attempt to restore my deleted IMAP messages, I did the following:

(1) Delete each of the IMAP accounts where messages were lost
(2) Use Settings=>Backup & restore=>Restore=>Device Storage to select the backup file
(3) Select Restore accounts and Restore emails, but not Restore app settings
(4) Select Restore

This started the restore. After the restore succeeded, all of those accounts were indeed restored. I went to each account and viewed their Inboxes, and all of the lost messages were then indeed showiing in the Inbox for each of these accounts.

HOWEVER (!!!)  ... the next time I synced any of the accounts in AquaMail, all the previously-deleted-and-then-restored messages disappeared again from the accounts' Inboxes. What I wanted is for those restored messages to be re-synced back to the IMAP server, so that they don't disappear again.

What can I do in AquaMail to properly accomplish this?

Thank you very much in advance.


Title: Re: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: TheHippoMan on June 23, 2025, 02:46:49 am
Follow-up:

If what I asked about above isn't possible, is there a way after I remove and then restore the account again to save all of the messages that are in the account's Inbox to somewhere outside of AquaMail?

If so, then I could write my own IMAP client in Python to read these saved messages one by one and store them in each of the accounts' Inboxes on the IMAP server.

I know that I can manually save each individual message by opening the message and using the menu at the bottom to export it as EML. But there are more than 3,000 deleted messages that I want to restore to the IMAP server, and it's therefore essentially impossible for me to do this for each message, one by one.

Is it perhaps possible with one single command sequence (not 3,000 repeated command sequences) to export a selected group of 3,000 messages as a group of EML files, one for each selected message?
Title: Re: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: TheHippoMan on June 23, 2025, 03:24:37 am
Another follow-up:

Or ... is there a way for me to parse the AquaMail.Accounts.backup file and extract all the messages from all of the account objects?

If so, I could then do this and write a Python IMAP client to then load all those messages into each account's Inbox on the IMAP server.

Could this perhaps be possible?
Title: Re: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: TheHippoMan on June 23, 2025, 04:41:37 am
... and if none of the above ideas are feasible, how about the following? ...

I send my AquaMail.accounts.backup file to the AquaMail company and pay them to use their software to extract all of the accounts and messages into the following filesystem directory structure, which they would then send back to me in some sort of archive file consisting of filesystem data in the following format ...

Top-level directory
    |-Account1 directory
    |    |-Folder1 directory - (message files)
    |    |-Folder2 directory - (message files)
    |    |- ... etc. ...
    |-Account2 directory
    |    |-Folder1 directory - (message files)
    |    |-Folder2 directory - (message files)
    |    |- ... etc. ...
    |- ... etc. ...

Then, I can write a Python IMAP client to traverse this structure and send the messages to the appropriate accounts and folders on the IMAP server.

The 3,000+ messages that I lost have value to me (including monetary value in some cases), and this is why I'd be willing to pay the AquaMail people for this service.

Title: Re: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: Martin - Aqua Mail Support on June 24, 2025, 01:24:21 pm
Hello TheHippoMan,

Thanks for the detailed explanation. Unfortunately, when you restore emails from a backup in Aqua Mail, they are stored locally and not automatically pushed back to the IMAP server. IMAP syncs only work from the server to the client, not the other way around.

To attempt restoring those messages back to the IMAP server, you can try using the Move to feature in Aqua Mail Move messages between accounts. After restoring the messages, select them and move them to another folder (like Drafts or a custom folder) under the same account. This may trigger Aqua Mail to upload them to the server.

Keep in mind this is not guaranteed to work reliably for large numbers of messages or complex folder structures, since IMAP upload support in email apps can be limited. If this doesn’t succeed, you may need to forward the important emails to yourself manually or export them as .eml files for uploading with a desktop client like Thunderbird or Outlook.

Let me know how it goes.

Title: Re: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: TheHippoMan on June 27, 2025, 02:39:08 am
Hi Martin.

I explained this same issue in a support ticket I raised with AquaMail, and you replied to it identically to what you have written here. But for the benefit of others who are reading this current forum, here's a summary of how I responded to your reply in that support ticket ...

I already tried the "Move to" feature, and the messages do not get uploaded to the upstream IMAP server. Not only that, but they disappear from the destination folder as soon as I follow the "Move to" with a sync.

Therefore, you are correct that this does not work reliably.

And I also explained there that this issue involves more than 3,000 individual messages that were lost, and the vast majority of them are important to me. Therefore, exporting all of them one-by-one to device storage as EML files is essentialy impossible for me.

To the rest of you reading this, it turns out that this support ticket with AquaMail is still open and my issue is still being investigated there, for which I am very grateful. And so maybe some sort of solution will end up being possible. In any case, I'll report the final outcome of that ticket here.
Title: Re: How to restore accidentally deleted IMAP messages via an AquaMail restore?
Post by: mikeone on June 29, 2025, 01:12:59 am
@TheHippoMan

Thank you for keeping the community up to date.

A small hope remains, because Aqua Mail's backup feature offers to back up messages as well as accounts. And luckily you had made the last backup only one day before you lost your messages.

I would really appreciate it if the developer team could find a way to move the restored messages - ideally with the entire directory structure - to a "local account" (similar to Tunderbird). From there it should then also be possible to transfer these folders, including the messages, from the local account to the original account using the IMAP protocol.