Using Mutt with Mac to read an Office 365 IMAP account

I love using lightweight software to do simple tasks. Why would you use bloated software to perform something as straightforward as reading and writing emails?

That is why I decided to use mutt on my Mac to read my personal email account.

My setup:

  • Office 365 Exchange account
  • Mutt on my Mac to read and write while at the computer
  • Postfix configured as a local relay for sending — so Mutt does not block waiting for a connection

Installation

brew install mutt

On Ubuntu: sudo apt install mutt

A note on authentication (updated 2026)

Microsoft deprecated Basic Authentication for Exchange Online in October 2022. Whether the config below works for you depends on your situation:

  • Personal Microsoft account (@outlook.com, @hotmail.com): generate an App Password at account.microsoft.com/security and use it in place of your regular password. Everything else stays the same.
  • Organizational O365 account: Basic Auth may be disabled by your tenant admin. If imap_pass fails with an authentication error, ask your admin whether Basic Auth or App Passwords are allowed. If neither, you will need OAuth2 — see the mutt-oauth2 script that ships with Mutt 2.x (/usr/local/share/doc/mutt/ on Homebrew).

If Basic Auth or App Passwords are available, the config below works as-is.

Mutt configuration

# Authentication
set imap_user="user@domain"
set imap_pass="password"        # use App Password if Basic Auth is disabled

set timeout=15

I know storing a password in a plain text file is not ideal, but I am the only one with access to this machine and the drive is encrypted with FileVault. If you prefer, leave imap_pass unset and Mutt will prompt you each time.

# IMAP
set mbox="imaps://outlook.office365.com/INBOX"
set postponed="imaps://outlook.office365.com/Drafts"
set spoolfile="imaps://outlook.office365.com/INBOX"
set folder="imaps://outlook.office365.com/"
set record="imaps://outlook.office365.com/Sent Items"
set trash="imaps://outlook.office365.com/Deleted Items"

Note: updated from imap:// to imaps:// (explicit SSL on port 993). Also, modern Mutt from Homebrew includes trash support, so that line is no longer commented out.

# SMTP — relay through local Postfix
set smtp_url="smtp://localhost/"
set from="user@domain"
set realname="Your Name"

I relay through local Postfix rather than connecting to Office 365 SMTP directly. This way, if I lose connectivity while writing, Mutt does not hang — Postfix queues the message and delivers it later.

Postfix configuration

Postfix relays outbound mail to Office 365. Edit /etc/postfix/main.cf:

biff = no
inet_interfaces = loopback-only
inet_protocols = ipv4
mail_owner = _postfix
mailbox_size_limit = 0
message_size_limit = 10485760
mydomain_fallback = localhost
mynetworks = 127.0.0.0/8, [::1]/128
relayhost = [smtp.office365.com]:587
smtp_generic_maps = hash:/etc/postfix/generic
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtpd_tls_ciphers = medium
unknown_local_recipient_reject_code = 550

Create /etc/postfix/sasl_password:

smtp.office365.com user@domain:password

Then hash it:

sudo postmap /etc/postfix/sasl_password

Add this line to /etc/postfix/generic to rewrite the sender address:

user@localhost user@domain

Hash it:

sudo postmap /etc/postfix/generic

Reload Postfix:

sudo postfix reload

That is it — start Mutt and enjoy lightweight email.


Last edit on: September 7, 2014

Last updated on: July 3, 2026

By: Guillermo Garron