Alpine with Office365 using Modern Authentication (OAuth2)

Summary: Instructions for installing Alpine in a Linux home directory and configuring to use OAuth2 for Office 365 e-mail.

Installing Alpine 2.26:

NOTE:  This is not officially supported by Technology Services (Campus IT) or Engineering IT - but these instructions are provided due to request - Use at your own risk.

Update 2026-10-06 - it appears that users that configured Alpine before 2026-10-01 can install and setup Alpine from scratch on a new computer without issue, but "new" Alpine users will get stuck at "Alpine needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it."  Engineering IT is waiting on clarification from Campus IT if this will be modified.

The list of officially supported e-mail clients is available at: https://answers.uillinois.edu/150086

Depending on your Linux Distribution, available alpine packages may be too old to connect to Microsoft 365.  These instructions show how to install Alpine 2.26 in your Linux home directory:
 
NOTE: You may need install some dependencies to build this software such as ncurses-devel or libncurses-dev.
 
mkdir -p ~/alpine-2.26/build
cd ~/alpine-2.26/build
wget https://alpineapp.email/alpine/release/src/alpine-2.26.tar.xz
tar Jxvf alpine-2.26.tar.xz
rm -f ~/alpine-2.26/build/alpine-2.26.tar.xz
cd ~/alpine-2.26/build/alpine-2.26
./configure --prefix=$HOME/alpine-2.26/
make
make install
rm -rf ~/alpine-2.26/build
cd ~/
export PATH=~/alpine-2.26/bin:$PATH
 
Note:  You will need to add 'export PATH=~/alpine-2.26/bin:$PATH' or similar to your .bashrc or .profile to modify your $PATH
 

Configuring Alpine

First - we'll run the program and quit it to generate a default ~/.pinerc file:
  1. Run the command 'alpine'
  2. Press 'E' to exit the default greeting
  3. Press 'Q' to quit (and 'Y' to confirm)
Now use your favorite text editor to modify your ~/.pinerc file and update the following fields:
personal-name=YOURLASTNAME, YOURFIRSTNAME
user-domain=illinois.edu
 
customized-hdrs=From: "YOURLASTNAME, YOURFIRSTNAME" <YOURNETID@illinois.edu>
smtp-server=smtp.office365.com/user=YOURNETID@illinois.edu/submit/auth=xoauth2
inbox-path={outlook.office365.com/ssl/user=YOURNETID@illinois.edu/auth=xoauth2}INBOX
postponed-folder={outlook.office365.com/ssl/user=YOURNETID@illinois.edu/auth=xoauth2}Drafts
trash-folder={outlook.office365.com/ssl/user=YOURNETID@illinois.edu/auth=xoauth2}Deleted Items
folder-collections=mail/[],Office365 {outlook.office365.com/ssl/user=YOURNETID@illinois.edu/auth=xoauth2}[]
Open Alpine again and you should be greeted with the message "Authorizing Alpine Access to Outlook Email Services":

Go to the URL from the message (https://microsoft.com/devicelogin) and enter the provided code - complete the web-based Office 365 based authentication steps.  Once you have completed the authentication steps in your browser, Alpine will prompt (at the bottom) "Preserve Refresh and Access tokens on DISK for next login?"  Select 'Y'.

Alpine will then create a "Master Password File" (at ~/.alpine.passfile, ~/.pine-passfile, or ~/.pinepw depending on your Linux distro - see the source code at alpine-2.26/configure.ac for this logic) - this is how Alpine protects your authentication to Office365 without having to go through the web-based authentication each time.  Create a master password for Alpine as prompted (and a second time to confirm).

Now you should be able to go to your "INBOX" and see your e-mail.
If you go to the Folder List you should see an "Office 365" option to see your account sub-folders (this is from the "folder-collections" setting in ~/.pinerc)
When you start alpine going forward, it will automatically prompt for the Alpine "master password" (the message is "Enter password of key <MasterPassword> to unlock password file:") - this is NOT your NETID password, but the password you created above - it is specific to Alpine only.

Official Documentation:



Keywords:
linux alpine mail email oauth2 pine 
Doc ID:
119374
Owned by:
Eddie W. in Engineering IT
Shared Services
Created:
2022-06-29
Updated:
2026-10-06
Sites:
University of Illinois Engineering IT