thunderbird-android icon indicating copy to clipboard operation
thunderbird-android copied to clipboard

"Edit as new mail" after send fail always sets the identity to default identity?

Open studyingegret opened this issue 4 months ago • 7 comments

Checklist

  • [x] I have used the search function to see if someone else has already submitted the same bug report.
  • [x] I will describe the problem with as much detail as possible.

App

Thunderbird for Android

App version

18.0b2

Where did you get the app from?

F-Droid

Android version

12

Device model

No response

Steps to reproduce

  1. Make sure you have 2 identities, one of which is the default.
  2. Turn off your device's network.
  3. Compose and send a mail with an identity that's not the default.
  4. Find the mail in the sending box, and choose "edit as new mail".
  5. Hit send button.
  6. View mail in sending box.

Expected behavior

The mail uses the identity that's not the default.

Actual behavior

The mail uses the default identity.

Logs

No response

studyingegret avatar Jul 31 '26 10:07 studyingegret

I guess that's a design choice but I too feel it should assume the original ("copied") mail's addressees.

mgw2013 avatar Aug 04 '26 05:08 mgw2013

@mgw2013 For context I asked on the forum if it's designed behavior but no one seems to know. No answers.

studyingegret avatar Aug 04 '26 09:08 studyingegret

I was able to confirm this. Adding a second identity to my account, filling out the email, and finding it in the inbox later does seem to produce the default identity instead of the selected non-default identity. It does seem to pull over the reply to field correctly, but would still send from the initial identity. Good catch!

dani-zilla avatar Aug 05 '26 22:08 dani-zilla

I found this bug in the sent mail folder too. If you click "Edit as new message" for an email you sent with a secondary identity, the default identity is shown instead. The same issue occurs when clicking the message header of an email you sent with a second identity because a bottom sheet is shown that displays the initial identity as the sender.

danielcoderman avatar Aug 08 '26 01:08 danielcoderman

I would like to get permission to work on this issue. I would use a debugger to understand the issue in more detail, and to modify the relevant code.

From my findings so far, the findIdentity method in LegacyAccountDto.kt is at least part of the problem because it isn't taking into account the personal field of the passed in Address object, but only the address field. What ends up happening is that the first identity that matches the address of the Address object gets returned, and that's the default identity. There's no chance for a non-default identity to be returned when it has the same email address as the default identity.

  @Synchronized
  fun findIdentity(address: Address): Identity? {
      return identities.find { identity ->
          identity.email.equals(address.address, ignoreCase = true)
          identity.name.equals(address.personal, ignoreCase = true) // new line: takes into account the personal field of the passed in Address
      }
  }

danielcoderman avatar Aug 10 '26 20:08 danielcoderman

I would like to get permission to work on this issue. I would use a debugger to understand the issue in more detail, and to modify the relevant code.

From my findings so far, the findIdentity method in LegacyAccountDto.kt is at least part of the problem because it isn't taking into account the personal field of the passed in Address object, but only the address field. What ends up happening is that the first identity that matches the address of the Address object gets returned, and that's the default identity. There's no chance for a non-default identity to be returned when it has the same email address as the default identity.

  @Synchronized
  fun findIdentity(address: Address): Identity? {
      return identities.find { identity ->
          identity.email.equals(address.address, ignoreCase = true)
          identity.name.equals(address.personal, ignoreCase = true) // new line: takes into account the personal field of the passed in Address
      }
  }

Thanks for getting interested in working on this. I've assigned the ticket to you! Feel free to contact us if you have any questions

rafaeltonholo avatar Aug 12 '26 18:08 rafaeltonholo

I appreciate the opportunity! Just to give an update, I have a working solution, but I still need to work on the tests.

danielcoderman avatar Aug 16 '26 06:08 danielcoderman