Closed Bug 983248 Opened 10 years ago Closed 8 years ago

Thunderbird selects wrong email account for Template

Categories

(Thunderbird :: Untriaged, defect)

24 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 394216

People

(Reporter: mmilgram, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release)
Build ID: 20140224132736

Steps to reproduce:

Configure 2 email accounts.  Save a template in the Template folder of one account.  Make sure that the from address is for that email account.  Double click on the template to send email with the template.  (Note, if this doesn't work with the template in the first email account, try with the second email account).



Actual results:

From line is from wrong account


Expected results:

From line should match the email account that holds the template, or better yet, that matches the saved From address.
If I compose email while reading email, it will pick a persona of the email account.  Why doesn't this happen with templates?
This bug is described further here:
http://forums.mozillazine.org/viewtopic.php?f=39&t=949215
and also happens on windows. 
When looking at the Headlines (Ctrl+U) Thunderbird saves the identiy for the account it has been created. When you create mail accounts in an different order on your second device the ids doesn't match and thunderbird takes the first/standard? mailaccount to compose the message.
This is pretty annoying for workgroups using a shared imap account to send templated messages from, because everyone has some other mail accounts and all gets mixed up.
This problem can be easily reconstructed with the following steps. 
Add two accounts. 
Create a template in one account. 
Move/copy the template to the other account and try to compose a message from it. It will always be sent through the account created the template.

This is also discussed here 
https://bugzilla.mozilla.org/show_bug.cgi?id=394216 which makes this bug a duplicate.

I digged into this and found the place where this could be changed. 
at comm-central\mailnews\mime\src\mimedrft.cpp in function mime_parse_stream_complete (beginning at line 1097 at the time of writing this) is a comment (line 1292):
// identity to prefer when opening the message in the compose window?
As I think this is some leftover before identitys where used to identify from which account a message should be sent (as the post from 2008 suggests).

Because Thunderbird is passing the identity from which a mail should be sent, I propose to change this behavior that "X-Identity-Key" tells which account should be used. Therefore it is necessary to remove the line 1293 in mimedrft.cpp (also the "if ( identityKey && *identityKey )" statement can be removed and lateron the writing of "X-Identity-Key" into a message. 

So sum this up, please remove:
"identityKey = MimeHeaders_get(mdd->headers, HEADER_X_MOZILLA_IDENTITY_KEY, false, false);" (currently line 1293 in mailnews\mime\src\mimedrft.cpp ) and the bug is fixed.

When have more time, remove the following if statement at the same file and further on, the whole writing of "X-Identity-Key" into a message (where I didn't looked up the places).

I tried this and it worked fine for me at all folder views thunderbird had to offer, but I don't want to go through the whole submit a patch process.

Thanks.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.