I think the ultimate problem @Astrin is experiencing is that Gmail's SMTP server is barking on the "insecure" authentication:
But your suggestion is exactly what I had before Google got picky about authentication, and now when I try your setup, I get the standard error message from Google:
Outgoing mail server (SMTP): Authentication error. 534 5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbssy 534 5.7.14 RyK0bWBUHMZnRBbf5AB3wmG8-pRplofCN4Ub-VkRG-kT5otiNIUaiJFJNVqrE7IATJSYAE 534 5.7.14 Z7AqMRa-etgKL_GfjdurwTI37kERqBFNKA1Ym-POQzL-7ksW8YxXOd418JOQJvKE1Hem34 534 5.7.14 oaqSFxtRcA8fL_4qjlTUXuXkBoScgaPvtprKCgRz-LKLJ6VE6a4a2cZZR1oAX18exJbgqU 534 5.7.14 ZI1TtoolUUTF2Lw6SdTEMrICuTTw> Please log in via your web browser and 534 5.7.14 then try again. 534 5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 i12sm29494115ywg.40 - gsmtp
And for that reason, (s)he wanted to use OAUTH just for the SMTP. Aquamail cannot do that at this point.
(Mixing different types of authentication for IMAP and SMTP is probably possible in principle. - At least I don't see anything that would forbid that, but I don't know Gmail's OAUTH. But this possibility is not implemented in Aquamail.)
@Astrin:
In the current situation, you will have to follow what GMail requests in that quoted message. Namely, go to that link and follow the instructions. And you might have to do that time to time...
Or, you may enable the "two-step" authentication for devices, which presumably would prevent your from such accidents, but you'd need to re-authenticate your devices about once every 6 months.. (I haven't used that myself.)
@Kostya:
From what I understand, Astrin's company is already using GMail SMTP service. So, he doesn't need to setup the aliases in Gmail.
(I suspect that in reality, that company has signed up a contract with Google to be the corporate mail provider, and the "internal" IMAP server might be essentially pointing to a dedicated Google's server (or it might be an internal server that mirrors Gmail's IMAP server). And that's why the username for the IMAP is not
[email protected] but just USER. But it is
[email protected] for authentication to the GMail's SMTP server.)
Or you can add the SMTP server into Gmail (in web mail) as an identity for sending, then add this identity into AquaMail under the Gmail account and work it that way. This will work with OAUTH.