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.


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/

We then need to edit this config.

My university email address uses

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

set from                       = ""
set realname                   = "Your name"
set hostname                   = ""
set imap_user                  = ""
set smtp_pass                  = "Your password here"
set imap_pass                  = "Your password here"
set folder                     = "imaps://"
set postponed                  = +Drafts
set record                     = +"Sent Items"
set trash                      = "+Deleted Items"
set smtp_url                   = "smtp://"
set spoolfile                  = "imaps://"
set imap_authenticators        = "oauthbearer:xoauth2"
set imap_oauth_refresh_command = "/CHANGE/ME/mutt/ /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.