Closed Bug 511780 Opened 15 years ago Closed 15 years ago

Archiving does not always place the messages in the correct account's Archive folder (Archive shouldn't use X-Account-Key: header, at least when account is not Global Inbox owner)

Categories

(Thunderbird :: Mail Window Front End, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0rc1

People

(Reporter: schwalbrichard, Assigned: Bienvenu)

Details

(Whiteboard: [no l10n impact])

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.1.1) Gecko/20090715 Thunderbird/3.0b3

I have three accounts (all POP) in TB3b3, each with a different email address. When I archive email messages under my account (main, default account) TB will occasionally place those messages into another email account's archive folder (randomly one of the other two). I haven't tested this enough to know if it's purely random, or a side effect of archiving large numbers of emails (maybe 10+).

Reproducible: Always

Steps to Reproduce:
1. Have more than one email account (occurs with POP accounts, do not know about IMAP).
2. Select more than 4 emails, preferably 10+, and archive (either via menu or 'A'). 
3. Check your email account's Archive folder.
Actual Results:  
Some of the archived messages ended up in other email account's Archive folder.

Expected Results:  
All archived messages for my account should end up in my Archive folder.
are you putting all your messages in the local folders inbox, i.e., the global inbox? Or do you move messages between the accounts' inboxes? The Archive code actually looks at the originating account of the message when deciding which folder to move messages to. And it only looks at the first message in the selection to pick the target folder, iirc.
David,
I don't use local folders. I just have a folder hierarchy for each account. For example:
My Email Account -> Inbox
-> Sent
-> Archives -> 2009

When I've selected a large number of emails from my account, whether from the Inbox or another folder in my account (not a local folder), some messages will be archived into another accounts Archive folder.

Hope this clears it up and I've answered your question.
Archive folder path is set in next entries.
> user_pref("mail.identity.idX.archive_folder", "mailbox://a@a.a.a/Archives");
> user_pref("mail.identity.idX.archives_folder_picker_mode", "0");
>  0 = Account's Archives folder.          Set via. "Archived folder on:"
>  1 = Folder specified in archive_folder. Set via. "Others:"
Note: Although concept of "Archive" is "per account", Archive folder setting is currently saved in "per identity" setting.

What path(and archives_folder_picker_mode) do you set in above setting?
Do you define multiple identities for an account?
I'm just using TB3 with default settings. archives_folder_picker_mode is reached via the Config Editor, correct? I haven't touched that, but looking at it now the value is 0 (zero). Also, I've set TB3 up with 3 distinct email accounts, all POP. Each email account has its own identity (1 email address == 1 identity). I do not have one overarching identity with 3 email accounts.
"Archive feature of Tb" looks to move mail to Archives folder based on X-Account-Keys: header of mail.
 - account2, account3, account4 are defined.
   dummy POP3 accounts. No Global Inbox use.
 - Inbox of account2 has 3 mails, and execute "Archive" for each mail.
     mail-1 : X-Account-Keys: account2 => Moved to account2's Archives folder
     mail-2 : X-Account-Keys: account3 => Moved to account2's Archives folder
     mail-3 : X-Account-Keys: account4 => Moved to account2's Archives folder
(It's Archive version of Bug 327713.)

Did you move downloaded mails to other account's folder?
Did you re-define accounts? (account number is altered)
Do you have old mails which was downloaded before the account re-definition?
It should have been next. Sorry for spam.
     mail-1 : X-Account-Keys: account2 => Moved to account2's Archives folder
     mail-2 : X-Account-Keys: account3 => Moved to account3's Archives folder
     mail-3 : X-Account-Keys: account4 => Moved to account4's Archives folder
The attached image should help clarify some of the confusion on how I have Thunderbird set up. It shows the 3 POP email accounts I have and their respective folder structures.
To answer your questions:
"Did you move downloaded mails to other account's folder?"

All emails that I archived and were placed under the wrong account's archive folder where in my account ("Richard", see attached image). Some of them were in my Inbox, others had been moved to subfolders within my account. None of them had ever been moved to another accounts Inbox or subfolder.

"Did you re-define accounts? (account number is altered)"

Here's where you might be on to something. All email was originally from Thunderbird. However, I had recently been testing out Postbox and had moved two of my accounts and emails to Postbox (for my Richard and Dick accounts). I also removed both my account and the Dick account from Thunderbird, leaving the Irene account in TB. Moving back to Thunderbird I re-created both my and the Dick account and moved the email files back under my Thunderbird profile directory. I then made my Richard account the default. At first, TB listed the accounts in the following order: Irene, Richard, Dick. After I set the Richard account as the default and restarted TB the accounts were listed in the following order: Richard, Irene, Dick. This order is actually how the accounts were created and listed before removing the Richard and Dick accounts. In other words, when moving back to TB from Postbox, the account listing order was inconsistent with the order prior to moving to Postbox. After changing the default account and restarting TB the account listing order is now consistent with the ordering prior to moving to Postbox.

"Do you have old mails which was downloaded before the account re-definition?"

Yes, most of the email I was archiving existed since before using the TB3b3 version, they came from when I was using TB2. Some of the email was downloaded while using Postbox. Others since I moved back to TB.

I'll try to give more details, hopefully to quickly point us in the right direction at to where and how this behavior originates. I just took 70 messages, all from the same sender to my email address, going back to 2008 and moved them to a subfolder under my account (Richard). I then selected all of them and performed an Archive procedure. I received the following error (will attach screenshot): "The operation failed because an other operation is using the folder. Please wait for that operation to finish and then try again."

That error popped up 4 or 5 times (had to click "OK" to get to each subsequent error message). I then checked the Archive folder for both the Irene and Dick accounts. Under Dick -> Archives -> 2009 there are 5 email messages that rightfully belong under Richard -> Archives -> 2009. These 5 messages were received recently (since returning to TB). Also, not all of the messages were Archived.

Now, if I only take 4 messages at a time and do an Archive then all seems to work fine. Maybe there's a problem with the number of emails being archived at once? Is there a limit as to how many the Archive function can handle at one time?

I will attach the error message I received, per above. I hope this helps further pinpoint exactly what is happening.
The attached error message is the one I was referring to in my reply. I received this message 4 or 5 times (possibly for each message that was sent to the wrong account's Archive folder).
(In reply to comment #9)
> Error message received while archiving

Independent problem from this bug's issue.
If .msf is outdated condition, internal rebuild-index can occur upon your archive operation. If auto-compact is enabled and you request Tb to do it automatically, compaction can occur upon your archive operation. If rebuild-index or compaction happens, such message can be displayed. Read Bug 498274 Comment #2, and check whether silently executed auto-compact is relevant or not first. If auto-compact is relevant, see bugs listed in Dependency Tree for Bug 498274, and open separate bug if Tb's fault is involved in the phenomenon after search B.M.O. well. 

> I'll try to give more details, (snip)

There is no need to explain what you did. Instead check next. 
  - Show "account" column of mail folder.
    mail header : X-Account-Key: accountN
    => prefs.js : mail.account.accountN.server = serverX
    => prefs.js : mail.server.serverX.name = abcdefg
    => abcdefg is displayed at "account" column
  - To which "Archives" folder does Tb move mail upon archive?
    Mail was moved to next "Archives" folder, wasn't it?
      mail header : X-Account-Key: accountN
      => prefs.js : mail.account.accountN.identities = idY
      => mail.identity.idX.archives_folder_picker_mode
         0 : This account's "Archives"
         1 : mail folder specified in mail.identity.idX.archive_folder
There is no "mail.identity.idX.archives_folder_picker_mode" line in my prefs.js file, only the "mail.identity.id1.archive_folder" line, which does correctly point to my account's Archive folder. While my account is "account2", it does have the id of "id1". I checked the headers of the emails that were sent to the wrong Archive folder and "X-Account-Key" did have the value of "account2". Is what I've experienced a byproduct of having upgraded from TB2 to TB3 in that the lines in the TB2 generated prefs.js file that TB3 is expecting do not exist, therefore causing confusion for TB3 under the right circumstances?

Should I create a clean, TB3 generated, prefs.js file? If so, what would be the best way to do so?
(In reply to comment #11)
> There is no "mail.identity.idX.archives_folder_picker_mode" line in my prefs.js (snip)

No problem. When initial status("Archives folder on:" is selected), mail.identity.idX.archives_folder_picker_mode doesn't exist. archives_folder_picker_mode=1 is created when archives folder is selected via "Others:", and is changed to archives_folder_picker_mode=0 when "Archives folder on:" is selected again.

> Should I create a clean, TB3 generated, prefs.js file?

This bug is not profile related issue. No need to create new profile. 
As you saw(if mail in accoutn3's folder has X-Account-Key: account2, mail is moved to Arcives of account2 instead of Archives of account3), and as I wrote before, this bug is "archive" version of Bug 327713.
Confirming, based on test result of comment #6 and observation of comment #11.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Workaround of your case is one of next, because cause is mismatch between account number of account definition and account number in X-Account-Key: of old mails. 
 (a) Keep account number in prefs.js.
     Change X-Account-Key: value in mail data to appropriate one, restart Tb,
     and rebuild-index. (simple script, BAT etc. can be used)
 (b) Keep X-Account-Key: of old mails.
     Change account number of account definition.
     Because mails downloaded after you re-defined accounts have X-Account-Key:,
     (a) is required for non-old mails after account number change.
Flags: blocking-thunderbird3?
If I change the account number of the account definition, wouldn't I need to do that for all 3 accounts? Also, how would one go about changing the X-Account-Key value in the mail data? Lastly, is this the normal behavior for TB, or is it related to something I may have done setting up my accounts?
(In reply to comment #15)
> If I change the account number of the account definition, wouldn't I need to do
> that for all 3 accounts?

It depends on situation(how accountX is different from accountN in prefs.js in your environment).

> how would one go about changing the X-Account-Key value in the mail data?

Tb's mail folder file is general Unix Mbox(search Google, please) file with added mail headers such as X-Mozilla-Status:, X-Account-Key: etc. Remove X-Account-Key: header(or change value of accountX to appropriate accountY) by BAT or script, then execute rebuild-Index.

> Lastly, is this the normal behavior for TB,

MS way answer: "This is SPEC", because Tb behaved as coded. :-)

> or is it related to something I may have done setting up my accounts?

Because current code produces problem you experienced, I think next is simplest workaround.
  If you don't use "Global Inbox", or if you don't want to be forced to use
  "Global Inbox", and if you need to re-define accounts, and if you need to
  access POP3 mail data downloaded before the re-definition of accounts,
  remove X-Account-Keys: header from all local mail folder files(by script),
  and execute rebuild-index of all locally held mail folders.
OS: Mac OS X → All
Hardware: PowerPC → All
Summary: Archiving does not always place the messages in the correct account's Archive folder → Archiving does not always place the messages in the correct account's Archive folder (Archive shouldn't use X-Account-Key: header, if account is not Global Inbox owner)
(In reply to comment #15)
> Lastly, is this the normal behavior for TB,

Non-MS way answer :-)

As written in comment #1, there is two issues which can produce phenomenon of comment #0.
(issue-1)
Even if account is not Global Inbox owner, move target folder of Archived is selected based on X-Account-Key: header of mail.
(issue-2)
When multiple mails are selected, X-Account-Key: header of first selected mail is used to determine move target folder of Archive.

issue-1 is problem since initial of Archive feature. 
issue-2 is simply a result of lack of care for "different X-Accont-Key:" case when enhancement of "archive of multiple mails at once" was implemented, probably.
Assignee: nobody → bienvenu
Flags: blocking-thunderbird3? → blocking-thunderbird3+
Target Milestone: --- → Thunderbird 3.0rc1
Summary: Archiving does not always place the messages in the correct account's Archive folder (Archive shouldn't use X-Account-Key: header, if account is not Global Inbox owner) → Archiving does not always place the messages in the correct account's Archive folder (Archive shouldn't use X-Account-Key: header, at least when account is not Global Inbox owner)
Whiteboard: [no l10n impact]
Attached patch proposed fixSplinter Review
Attachment #401914 - Flags: review?(mkmelin+mozilla)
Whiteboard: [no l10n impact] → [no l10n impact][has patch for review]
(In reply to comment #18)
> proposed fix

After the change, can we expect next?
  Behaviour of archive feature is not affected by archive setting of account who
  uses Global Inbox(hidden account at folder pane).
If yes, we are better to open bug for "hide or gray out archive setting"?
That's a good question. I think for global inbox users, the archives folder should be set to the local folders account Archives folder for all the deferred accounts, but I don't know if that happens.
Comment on attachment 401914 [details] [diff] [review]
proposed fix

Global inbox seems fine (with this patch) - archives under Local Folders/Archives
Attachment #401914 - Flags: review?(mkmelin+mozilla) → review+
fix checked in.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [no l10n impact][has patch for review] → [no l10n impact]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: