How to setup personal outlook account in Aerc?

I’m using the Aerc mail client and I’m trying to setup my Personal outlook account on it. I’m also using the Oama authentication for OAuth and I want to know how to use it to avoid plaintext passwords.

My aerc config at /home/username/.config/aerc/accounts.conf looks like this:

[Personal]
source        = imaps://username%40hotmail.com@outlook.office365.com:993
outgoing      = smtp://username%40hotmail.com@smtp-mail.outlook.com:587
default       = INBOX
from          = Me <username@hotmail.com>
copy-to       = Sent
cache-headers = true
source-cred-cmd   = echo PASSWORD
outgoing-cred-cmd = echo PASSWORD

But When I open aerc with this config, the authentication fails and I don’t know why.

  • I have a legacy hotmail.com email address
  • I enabled IMAP on my Outlook settings

But I don’t know how to configure a personal outlook email. I can configure my University’s Office365 email, but this eludes me.

I also want to know how to edit source-cred-cmd and outgoing-cred-cmd to not echo my plaintext password