This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Deleted All mail file by accident

  • 4 replies
  • 1 has this problem
  • 6 views
  • Last reply by Trevor

more options

Yesterday I deleted the All Mail file of my Gmail account by accident on my iPhone while away from my computer. When I got back to my computer I discovered that this had chewed through a lot of my files and I had many empty files including some which were archived in Thunderbird so should have been saved on my computer. No problem I thought, I will undelete files using webmail but when I went into Gmail webmail I found that I didn't have many messages left. In my backup file which I checked in Thunderbird offline, I had about 24,000 messages but could only find about 4,000 on the webmail account. As soon as I went online with Thunderbird, the messages in my backup began deleting to match the online situation. So I have a number of questions.

How did deleting the All Mail file on my phone somehow affect my archived messages stored in Thunderbird in my local files? I suspect they are part of the same string that makes up All Mail but should somehow be separated.

Notwithstanding that issue, the main problem is how I can use my back up to repopulate the online Gmail string so I don't continually get the truncated Gmail which is revealed in my webmail. Is it possible to reverse ImapMail so that the web Gmail matches my backup rather than the usual reverse situation? In the meantime, I can use my account at the cost of losing messages every time I go online but I need to recover from this situation fast.

Yesterday I deleted the All Mail file of my Gmail account by accident on my iPhone while away from my computer. When I got back to my computer I discovered that this had chewed through a lot of my files and I had many empty files including some which were archived in Thunderbird so should have been saved on my computer. No problem I thought, I will undelete files using webmail but when I went into Gmail webmail I found that I didn't have many messages left. In my backup file which I checked in Thunderbird offline, I had about 24,000 messages but could only find about 4,000 on the webmail account. As soon as I went online with Thunderbird, the messages in my backup began deleting to match the online situation. So I have a number of questions. How did deleting the All Mail file on my phone somehow affect my archived messages stored in Thunderbird in my local files? I suspect they are part of the same string that makes up All Mail but should somehow be separated. Notwithstanding that issue, the main problem is how I can use my back up to repopulate the online Gmail string so I don't continually get the truncated Gmail which is revealed in my webmail. Is it possible to reverse ImapMail so that the web Gmail matches my backup rather than the usual reverse situation? In the meantime, I can use my account at the cost of losing messages every time I go online but I need to recover from this situation fast.

All Replies (4)

more options

Gmail stores all your emails in the 'All Mail' folder. Gmail understands this is a very inconvenient way to view emails so they created 'Labels' eg: Inbox This means the email in 'All Mail' folder gets a type of flag or tag called 'Inbox' thus allowing a virtual view of the email with the 'Inbox' label to be seen in the 'Inbox'.

In Thunderbird, it uses 'folders' not 'labels'. All imap account folders synchronise with server 'labels' to show whatever is in the respective 'label'.

When you delete an email and you make sure it has gone into the gmail imap Trash' folder, gmail reads this as delete the email from the 'All Mail' folder. If you delete an email but do not put into the gmail imap Trash folder then Gmail reads this as remove the 'Inbox' label and archive original in 'All Mail'.

If you delete the 'All Mail' folder, then gmail reads this as delete the 'All Mail' folder and contents. By default it always recreates the 'All Mail' on server because it is the one and only folder that stores emails. As nothing is in the 'All Mail' folder then nothing can be displayed in any of gmail 'labels'.

When an imap account then synchronises will server 'Inbox', it displays what is in Inbox label - nothing.

Regardless of whether you download full copies or only headers, the contents of that imap folder can only display whatever is on server.

If you then try to add emails back into the imap account via replacing a backup copy whilst Thunderbird is closed, upon start up the first thing Thunderbird imap does is to synch with server - nothing on server so emails are deleted as per what is on server.

You need to import the backup mbox files into 'Local Folders' mail account. Then you can use right click on selected emails and use 'Copy to' and select 'Inbox' - this should put emails back on the server as you are now uploading to server. It would take quite a while as there is a limit on how much you can upload to server via imap.

more options

Thanks, that's helpful - how to I import backup mbox files into local folders mail in my account? I can't access local folders when offline so would have to be online. I can identify specific labels in the saved Mail file under each year - how do I import these - there are two files under each label - do I have to import both?

more options

Must admit I've not tested out the importing using Thunderbird as it seems to talk about entire profiles. So I do it like this because it's so quick to copy and paste all the files and folders from backup - If you have a backup of 'ImapMail'/gmail account name'/all contents you need to copy here.

In 'Local Folders' mail account:

  • Create a new folder which is suitable for receiving all gmail: 'Gmail Backup'

In Thunderbird

  • Help > TRoubleshooting Information
  • Under 'Application Basics' half way - Profile Folder - click on 'Open Folder'

A new window opens showing the contents of your Profile name folder

  • Exit Thunderbird now
  • click on 'Mail' folder to see contents
  • Click on 'Local Folders' fodler to see contents
  • You should see a folder called 'Gmail Backup.sbd' - click on folder to see contents.

It should be empty and this is where you paste the copies of all your backup mbox files and any folders which have a .sbd extension. mbox files do not have any extension and contain emails. It does not matter if you also copy over all the .msf index files. So in effect you can copy all the files and folders and put them in that 'Gmail Backup.sbd' folder.

Then start up Thunderbird and you should see them all in the Local Folders mail account.

Image as guide.

more options

Many thanks. As backup was a few weeks old hasn't completely replaced everything but that's my fault for being lazy. Steps worked fine. Worth saying that moving the files is greatly assisted by ImportExportTools NG add-on which, as an add-on isn't present in the basic Thunderbird set-up and needs to be downloaded.