I am not sure if I understood you correctly, but I'd like to suggest a couple of ways that might help you achieving what you want.
First, let me confirm how I understood what you want to achieve:
Messages sent to A@gmail.com and B@gmail.com arrive to A@gmail.com, and A@gmail.com is set as the account in Aquamail.
You want that all your outgoing messages would
automatically be sent with From: B@gmail.com
Right?
1. If you have only one account in Aquamail, then you can disable "reply with the same account as email was sent to" and instead choose the identity B@gmail.com as the "Default account" under Settings -> Composing and sending -> "Default Account".
2. If your account A@gmail.com is set up as a "generic" IMAP account (as opposed to "Gmail" which is using OAuth2-based). If not, - you can create it that way.
If you set it this way, there will be a few differences:
a) If you are traveling to a very different geography Gmail is more likely to prevent your from logging into your Gmail until you confirm legitimacy of your login via web interface.
b) Every 2-3 weeks you will see "red" notifications that the SSL certificate has changed and you need to "accept" the new certificate. This can be turned off via Settings-> Network -> SSL validation -> uncheck.
(in the most recent version "SSL validation" name changed to something like "SSL certificate change detection").
Beware, that unfortunately, this setting affects all IMAP accounts in Aquamail.
If you are willing to pay this price for the desired behavior:
You can create a new account (Add a new account), choose the type "IMAP.
Enter: <i>Email B@gmail.com</i> (this is the key moment!)
Password: <enter the password for A@gmail.com> (this is also the key moment!)
Then you touch "
manual" at the bottom.
On the screen for "Incoming server"
All settings are going to be fine, except that you need to scroll down and change "Login" (which will be automatically set to B@gmail.com) to A@gmail.com (or simply "A", without the quotation marks, of course.)
- > Next
On the next screen, "Outgoing server" (SMTP server), repeat the same procedure if needed.
This will work, if your B@gmail.com identity is set up as an alias/identity in Gmail (i.e. you can send as B@gmail.com from the webmail interface while logged in into A@gmail.com account).
If that is not done, then you can set your outgoing server here to use
Login B@gmail.com, and enter the corresponding password.
This way you'd be reading messages from A@gmail.com account, but sending through B@gmail.com account.
Note that in this case, Gmail will not automatically save all outgoing messages into A@gmail.com's "Sent Mail" folder. It is not a problem. In Aquamail, you enable to save a copy of sent messages to "Sent" account, and it will automatically save it into A@gmail.com (I am not 100% sure, but this might be the default setting already. But check it just in case.)
You do not need to create any identities for this account.
That's it. You'll be reading your messages from A@gmail.com. If you keep "reply with the same account as email was sent to" enabled, your responses will be automatically started from B@gmail.com .
In case your mail is not Gmail account, and you only used those name as an example, and thus you already have it as an "IMAP account" in Aquamail, you can edit the settings for the existing account.
Go to Settings -> Account Setup. And the follow the same instructions as above for adding a new account.
While I was writing this, @nica suggested yet another good solution, which will also work, of course. In that case, if you have a long history of messages in A@gmail.com with many labels/folders that you want to keep that way and use, you'd want to transfer them to B@gmail.com. There are actually ways of transferring your Gmail folder structure from one account to another. You can google those.
Here is one old page (some tools might no longer be active) that was discussing some options for doing a backup of a Gmail account. Some of those might work as a way of transferring messages to a new account.
http://gmail-tips.blogspot.com/2012/01/gmail-backup.htmlHTH.