Open Bug 1714389 Opened 3 years ago Updated 1 year ago

Missing body after message copied into a subfolder by Filter

Categories

(Thunderbird :: Filters, defect, P2)

Tracking

(Not tracked)

People

(Reporter: typograph, Unassigned)

References

(Depends on 1 open bug)

Details

(Keywords: dataloss)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0

Steps to reproduce:

I have two IMAP accounts, and both have the following filter:

  • Copy message to Local Folders/Inbox
  • Move message to a subfolder

Actual results:

Since I created this filter, there are some emails that appear empty in local folders, but not in the original account. Sender info and message header are shown for these emails, but no text appears inside, message source looks like this:

From - Wed Jun 02 13:55:27 2021
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:

Expected results:

This might be related to bug #716810 -- all emails that were empty today had a dash in the sender's email address.

Component: Untriaged → Filters

I rechecked and the effect does not seem to depend on the email address -- I had two emails from the same address on different days, one empty and one not.

Severity: -- → S2
Priority: -- → P3
Summary: Emails empty after copying via message filter → Missing body after message copied into a subfolder by Filter

Reported by two people, so I'm changing this to confirmed.

So the question is, what is causing this? Have you uncovered any additional clues?

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(typograph)
Flags: needinfo?(regnad99)
Keywords: dataloss

Trouble-shooting info:

My filters were originally set up to Move a filtered email to an archive folder; however, those filters always left the original one in place. In short, the operation Copied instead of Moved. I recently changed the filter to implement two steps: 1) Copy to archive folder, then 2) Delete the original. So, perhaps there is something in the Copy operation, or the subsequent Delete operation that is causing the problem.

Also, all of my archive folders are under a different email address. The behavior I am seeing is that the copied email arrives in the archive, but the body is missing. So, perhaps it has something to do with copying the email to an archive in a different email account.

While I recently changed my filters, I changed them before my most recent Thunderbird update and did not see the problem before that. I am currently using v78.11.0 (32 bit). While I typically update Thunderbird soon after an update is available, I do not know exactly which version I was on before the problem appeared. Sorry.

I hope this gives you an idea of where to look.

My setup is very close to what regnad99 has described -- this happens when copying messages between different accounts (in my case an IMAP account and Local Folders). I will test as soon as I can if this is related to copying/moving and/or different accounts (I have turned this filter off last week, was too irritating).

I have run a small test right now, where I tried to run this filter on some messages that copied empty before, and, interestingly, copying worked flawlessly for all destinations when I ran the filter manually after putting the messages to the original inbox. However, when the filter was set to run on new mail, and I put the messages into the inbox, all of them copied empty to Local Folders, only some of them were copied to a different folder on the same account and all were moved correctly. From this I wonder if it could be a timing issue -- maybe the message is being copied before it 'arrives'?

Is filtering occurring after junk classification?

I am of the opinion that particularly with IMAP accounts there is a timing issue where the message header is added to the database before the entire message is downloaded which triggers the issues with missing bodies when copied or moved. I have yet to see anyone that still had issues after they set filter execution to after classification.

Setting the filter to run after junk classification seems to fix the issue. Except that now messages are copied to Local Folders twice -- apparently moving to a different folder on an IMAP account counts as getting new mail.

It would be nice to have "filter after junk classification" as a default setting for IMAP accounts.

Flags: needinfo?(typograph)

It all worked fine for many years, even with IMAP accounts, until a recent upgrade. Is it possible to restore the original behavior? I get far more junk than anything else. My filters identify the sources and topics I want to keep and move them to Archive sub folders, then my last filter puts everything else in Trash. Then, all items in Trash are deleted when I close Thunderbird. This approach has saved me countless hours over the years.

Setting the filter to run after junk classification brings other unexpected issues. Now the filter runs on all folders, meaning it runs twice on the message -- in the old and in the new folder -- and it also runs on message drafts, meaning every message I am writing long enough gets copied every time it's saved, and also does not stay in the Drafts folder. I managed to limit the filter to only running on Inbox via FiltaQuilla, but this does not feel like a good solution. What logic does Thunderbird use to define "new mail" for the filters?

Danny, Calum, can you reproduce this?

Flags: needinfo?(regnad99) → needinfo?(calum.mackay)

I cannot reproduce this but it continues to occur intermittently on a regular basis. It is most likely to occur when multiple emails arrive to a gmail account. I have filters set up on that account where emails from specified senders get moved to a topic-specific archive folder under a different email account (that uses pop3).

I am running the filters before Junk classification. I don't rely on the Junk mechanism in Thunderbird - my own filters specify what I deem to be Junk.

The filter is set up to look at the sender and

  1. Copy the emails from specific senders to a topic-specific local archive folder
  2. Delete the email from the gmail account. This moves the email to Trash

When multiple emails arrive at the same time, the filter correctly intercepts the target emails and copies them to the archive folder, but some arrive without the body of the email. Next, the filter deletes those emails from the gmail account, which moves them to Trash under the gmail account. The emails in the Trash folder always include the body.

I also have the gmail account set to clear the Trash folder when Thunderbird is closed. This saves me a tremendous amount of time. Unfortunately, since this problem started to occur I need to check each copied email to make sure it is intact and manually copy those that are missing the body before I close Thunderbird and clear the Trash folder.

It seems like a sequencing problem to me. The email must arrive in multiple steps and the first step in the filter (copy) runs before the full email has arrived. The full email appears to arrive after the copy operation but before it is deleted and moved to the Trash folder, so it is intact by the time the delete operation runs.

I have been using filters like this for years without problems. I keep Thunderbird relatively current but may miss an update occasionally. The problem started immediately after an update and I identified that update version in an earlier email.

No, I can't reproduce on Daily 1013. MacOS 10.15.7

Both the copied to Local Folders, and moved to IMAP subfolder, messages seem OK.

However, I don't have Junk Classification enabled at all, so perhaps that's not surprising?

Flags: needinfo?(calum.mackay)
Priority: P3 → P2

This bug happens for me every time that multiple emails are filtered and copied or moved at the same time. The first email arrives with the body intact but every subsequent email that is filtered at the same time is missing the body.

For example, if I have a filter that looks for:

"To" ending in @somewhere.com
"From" ending in @somewhere.com
"Copy (or Move)" to my "somewhere" subfolder in Archive

When multiple emails fit that criteria arrive at the same time, only the first filtered email arrives intact. All others are missing the body of the email.

Very much looks like bug 1781792 (which is caused by bug 662056) except for the few emails with the dash in the sender's email address, which indeed looks more like bug #716810.

Please try to use the following filter actions in this precise order and report back, if it solved your problems:

1. "Move later" to Imap Sub-Folder
2. Copy to Local Folder

This solution works for IMAP accounts and depends on the Filtaquilla Addon.

Depends on: 662056
You need to log in before you can comment on or make changes to this bug.