The below won’t work now that UCL has mandated OAUTH2. You can instead get isync and msmtp to work with OAUTH2 although it takes some configuration. oauth2ms and the mbsync configuration it suggests worked for me, but you must make sure the Azure app you create is set to web not mobile/desktop. To get smtp working you must change the msmtp config file to read

auth xoauth2
passwordeval /correct/path/to/oauth2ms

If you want to use sup or Notmuch to manage your email, you need to configure OfflineIMAP (or similar) to actually get the hated emails onto your system. Here’s how to configure OfflineIMAP for a UCL email account.

  • make a folder to hold the email. I used ~/mail/ucl/.
  • make ~/.offlineimaprc containing the below. I don’t know if the ui or sslcacertfile lines are necessary (you’d better check that the path is correct on your system if you’re going to include it). You need to modify the remoteuser and remotepass lines appropriately, of course. There are ways to avoid having your password in plain text here, see the OfflineIMAP website.
  • run offlineimap and be prepared to wait a long time on the first run.
[general]
accounts = ucl
ui = ttyui

[Account ucl]
localrepository = localucl
remoterepository = remoteucl

[Repository localucl]
type = Maildir
localfolders = ~/mail/ucl

[Repository remoteucl]
type = IMAP
remotehost = outlook.office365.com
remoteuser = ucXXXXX@ucl.ac.uk
remotepass = YOUR PASSWORD
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

None of your email will be viewable because of the way Microsoft choose to manage email. You need to follow the HTML email instructions at this link.