Ok, if you want to authenticate directly with Exchange Online, then no connectors are needed. My suggestions are for authenticating with the Server A on-prem and letting it route to Exchange Online.
If you want to connect to directly to Exchange Online with IMAP, that wont work unless your client supports Modern Authentication. Basic Auth is no longer supported in Exchange Online
[https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online
To Use IMAP, you would need a modern auth IMAP client:
[https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth
TO send via SMTP through Exchange Online, the tenant would need SMTP Auth enabled for your mailbox:
Option 1 sounds like what you need:
[https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#option-1-authenticate-your-device-or-application-directly-with-a-microsoft-365-or-office-365-mailbox-and-send-mail-using-smtp-auth-client-submission