Little different for Office365 email from the University where Duo 2FA login is required for emails like abc@manchester.ac.uk. Here, I couldn't use the mutt-wizard automated process to succeed. Therefore, I did each manual every step and I couldn't find on the internet the total steps to be followed exactly for this kind of account.
Learn from these links
http://pnijjar.freeshell.org/2022/mutt-uw-duo/
https://wiki.archlinux.org/title/Isync#Using_XOAUTH2
Step-by-Step Guide (commands are in bold) -
1. Request IT services to enable IMAP for your University account
2. Follow the first link to edit the mutt_oauth2.py file accordingly and once you execute the command given below, you may not need to follow the rest. Here, I used the same email address abc@manchester.ac.uk for editing that file (i.e. for creating gpg key) and for the command below where you need to provide your University email address.
~/bin/mutt_oauth2.py ~/.mutt_token--verbose –authorize
3. yay –S cyrus-sasl-xoauth2-git
4. Manually Add to .mbsync file
IMAPAccount abc@manchester.ac.uk
Host outlook.office365.com
User abc@manchester.ac.uk
PassCmd "/home/user/bin/mutt_oauth2.py /home/user/.mutt_token"
AuthMechs XOAUTH2
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
Timeout 120
PipelineDepth 50
IMAPStore abc@manchester.ac.uk-remote
Account abc@manchester.ac.uk
MaildirStore abc@manchester.ac.uk-local
SubFolders Verbatim
Path /home/user/.local/share/mail/abc@manchester.ac.uk/
Inbox /home/user/.local/share/mail/abc@manchester.ac.uk/INBOX
Channel abc@manchester.ac.uk
Far :abc@manchester.ac.uk-remote:
Near :abc@manchester.ac.uk-local:
Patterns "INBOX"
Create Both
Expunge Both
SyncState *
MaxMessages 0
ExpireUnread no
# End profile
5. Manually Create abc@manchester.ac.uk.muttrc file at this location .config/mutt/accounts/
6. Add to abc@manchester.ac.uk.muttrc all those commands, similar to Gmail file : abc@gmail.com.muttrc or Outlook file: abc@outlook.com.muttrc
7. Manually add a MaildirStore folder for abc@manchester.ac.uk, similar to abc@gmail.com which was automatically created using mutt-wizard. Otherwise, you will see MaildirStore error : cannot open store
8. mbsync -V abc@manchester.ac.uk
9. neomutt