Using mutt for Glasgow University email

This post details setting up mutt (specifically neomutt) to work with the new Glasgow University OAuth2.0 system.

I mainly suppliment the information already available.

Namely, I figured out how to configure my client using the following:

A post by Dejice Jacob on the same topic

Peter van Ormondt's guide on mutt for outlook OAuth

The University of Warwick guide for mutt by Mike Willis

I hope to provide a bit more information that helped me complete my config.

Setting up mutt in general

I use the mutt-wizard to configure neomutt and use all the optional dependencies except mpop.

mutt-wizard

University email

The next step is to get the OAuth2.0 script needed to periodically fetch your token.

This process is detailed in the post by Dejice Jacob and in the guide by Peter van Ormondt.

Once you have neomutt working and the script and token file created *do not* use the mw command to add an account.

Mutt-wizard only configures plain authentication so it will just create a bunch of configs that you will then need to track down and delete.

Instead you need to manually create a config file for your account.

touch ~/.config/mutt/accounts/your@email.here.muttrc

We then need to edit this config.

My university email address uses @researc.gla.ac.uk.

If you instead use @student.gla.ac.uk or whatever remember to change that part, as well as the parts of this config that pertain to your details.

set from                       = "your_email_here@research.gla.ac.uk"
set realname                   = "Your name"
set hostname                   = "gla.ac.uk"
set imap_user                  = "your_email_here@research.gla.ac.uk"
set smtp_pass                  = "Your password here"
set imap_pass                  = "Your password here"
set folder                     = "imaps://your_email_here@research.gla.ac.uk@outlook.office365.com"
set postponed                  = +Drafts
set record                     = +"Sent Items"
set trash                      = "+Deleted Items"
set smtp_url                   = "smtp://your_email_here@research.gla.ac.uk@smtp.office365.com:587"
set spoolfile                  = "imaps://your_email_here@research.gla.ac.uk@outlook.office365.com/INBOX"
set imap_authenticators        = "oauthbearer:xoauth2"
set imap_oauth_refresh_command = "/CHANGE/ME/mutt/mutt_oauth2.py /CHANGE/ME/mutt/TOKEN_FILENAME"
set smtp_authenticators        = ${imap_authenticators}
set smtp_oauth_refresh_command = ${imap_oauth_refresh_command}

mailboxes "=INBOX" "=Sent Items" "=Deleted Items"

You can add any extra mailboxes needed by editing the last line of the config.

This config will store your password this way which is not great.

You can instead use any utility such as pass to encrypt it.

pass

Using mutt for Glasgow University email was published on 2023-05-01