Open Bug 515004 Opened 15 years ago Updated 2 years ago

Identity guessing relies on X-Account-Key header (If folder owner is not Global Inbox owner, X-Account-Key: shouldn't be used for identity selection)

Categories

(Thunderbird :: Mail Window Front End, defect)

defect

Tracking

(Not tracked)

People

(Reporter: jwkbugzilla, Unassigned)

References

(Blocks 2 open bugs)

Details

Thunderbird 3.0 Beta 3 does a good job guessing my identity when I reply to mails. However, every now and then it would mess up completely and select an identity from a different mail account. Occasionally I realized that it looks at the X-Account-Key header of the mail and then tries to find an identity in the specified account. But much of my mail came into a different account originally and was moved later. I had to do a search&replace in the mail file and rebuild the index - but I think Thunderbird should be able to determine which account a mail belongs to without relying on these headers.
New issue of Tb 3.0 Beta? (no problem with Tb 2.0.0.x?) DUP of Bug 327713?
Yes, new issue - Thunderbird 2.0 didn't have identity guessing at all, just picked the main identity every time. Bug 327713 seems to be slightly different since in my case the mail is sorted into a particular account - but the identity is selected from a different account nevertheless.
"Reply to self" case? Mail addresses of From:/To: are identities you defined? Which account owns mail folder? What is set in X-Account-Key: of mail? Identity preset in From: filed upon reply is defined under which account? > mail.account.accountN.identities = idX > mail.account.accountN.server = serverY Same mail address is defined by multiple identities? > mail.identity.idX.useremail = abc@def.ghi.jkl
No, not reply to self. I have multiple accounts, account1 has only one identity - palant@foo. account2 has multiple identities - palant@bar1, palant@bar2, palant@bar3. So all identities are associated with different email addresses. In this case the mails are addressed to palant@bar2, coming from various people. They all had "X-Account-Key: account1" stated in the headers because account1 used to be something different before. As a result, when I choose to reply I see palant@foo selected rather than palant@bar2. As I said, once I've replaced all occurrences in the mailbox by "X-Account-Key: account2" and rebuilt the index the issue was fixed.
The problematic code is function getIdentityForHeader in mailCommands.js. It gets the server from hdr.accountKey (this overrides the server determined from hdr.folder) which is the value of "X-Account-Key" header. It then retrieves the identities for that server and uses only those identities for guessing the correct identity. Since in my case that account only has one identity (palant@foo) that one is being selected. I can see at least two solutions here: 1) Make the server determined via hdr.folder override the one determined from hdr.account (in that case if a folder isn't associated with an account "X-Account-Key" will still be looked at). 2) Use identities from all accounts for guessing but prioritize the ones from the current account in case we have multiple matches. I would like to see the second solution implemented even though the first one is easier.
(In reply to comment #4) It's a phenomenon of Bug 327713. (In reply to comment #5) Third solution(I requested in Bug 327713. a variation of your 1). 3) If folder owner is not Global Inbox owner, don't use X-Account-Key: of mail data to determine preset From: mail address. I think 3 is easier than 2/3, and 3 never touches Global Inbox related code. (1 and 2 should care for Global Inbox case.) Can you propose patch?
If patch is proposed by this bug, Bug 327713 will be fixed. Setting dependency for ease of tracking.
Blocks: 327713
FYI. Bug 327713 Comment #42 looks an easy workaround(originally written in Bug 358324 Comment #8), although care for keeping identical setting is required.
Following is a part of patch for Bug 511780. (Stop X-Account-Key use for Archives) > - identity = getIdentityForHeader(msgs[0]); > + identity = getIdentityForServer(srcFolder.server); > + // Local Folders server doesn't have an identity, so if we don't > + // get an identity from the server, figure it out from the message. > + if (!identity) > + identity = getIdentityForHeader(msgs[0]); "Global Inbox owner or not" is irrelevant to that bug. Only "Has identity or not" is relevant. In patch for this bug, "POP3 account as Global Inbox owner" should be cared for. If Global Inbox owner, getIdentityForHeader(msgs[0]) should be used.
It looks unconditional call of getIdentityForHeader at next is the reason. http://mxr.mozilla.org/comm-central/source/mail/base/content/mailWindowOverlay.js#840 > 842 let myEmail = getIdentityForHeader(msgHdr).email; If this is changed like next, this bug's problem may be bypassed. if( POP3_account && !(Global_Inbox_Owner) ) { let myEmail = getIdentityForServer(Folder_holds_mail.server).email; } else { let myEmail = getIdentityForHeader(msgHdr).email; } It may produce different result by "reply to self" from current, because selected account/identity will be changed.
Summary: Identity guessing relies on X-Account-Key header → Identity guessing relies on X-Account-Key header (If folder owner is not Global Inbox owner, X-Account-Key: shouldn't be used for identity selection)
(In reply to Wladimir Palant from comment #4) > No, not reply to self. (In reply to Wladimir Palant from comment #2) > Yes, new issue - Thunderbird 2.0 didn't have identity guessing at all, just > picked the main identity every time. Bug 327713 seems to be slightly > different since in my case the mail is sorted into a particular account - > but the identity is selected from a different account nevertheless. If so, X-Identity-Key: header case? > bug 264626 From address changes to different mail account > when forwarding mail containing X-Identity-Key header from sender > [See dependency tree for bug 264626] What is exact "silght difference of your bug report from Bug 327713"? Bug 327713 is for any of (a) "X-Identity-Key: of mail with existent accountN" case, (b) "X-Identity-Key: of mail with non-existent accountN" case, (c) "no X-Identity-Key: in mail" case, although difference by cases is not so clearly stated in that bug. Read bug 592935, which is still kept open for ease of problem analysis and tracking, please.
Read X-Identity-Key: on bug 327712 in previous comment as X-Account-Key:, please. Can I consider this bug explicit "request for not using X-Account-Key: based identity selection when non Global Inbox"? (it's currently rejected in that bug)

Giacomo writes

bug 515004 seems to be partially gone or imho a partial bug, in that when I reply to a message with say "X-Account-Key: account15":

  • the reply sender is automatically set to account15's email adress if the original message lies in my Global Inbox (which gathers more than one account)
  • the reply sender is automatically set to the "host account"'s email address if the original message lies in an account's specific local folder though I would personally always expect the sender to be set to the original message's addressee independently of the account it's being dealt within,

TB 60.5.1 (64-bit) on MacOSX 10.13.6 still behaves that way.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.