I'd like to try to connect my mutt email client to my Google account. However, this account is managed (G Suite) and we login via what looks like Active Directory. I'd like to connect mutt to this account, but I suspect it is failing because of one of two things (or both):

  • Login fails because I didn't sign in with Active Directory
  • I've entered inaccurate information in my config file, due to the custom domain name our organization (G Suite) is using.


  • My email is [email protected],
  • My password (from logging in via Active Directory) is aBcD1234,

my configuration file looks like this:

# ~/.muttrc
# ~~~~~~~~~
set from = "[email protected]"
set realname = "Foo Barrington"

set smtp_url = "smtps://[email protected]"
set smtp_pass = "aBcD1234"
set record = ""

set imap_user = "[email protected]"
set imap_pass = "aBcD1234"

set folder = imaps://imap.gmail.com
set spoolfile = +INBOX
set record "+[Gmail]/Sent Mail"
set postponed = "+[Gmail]/drafts"

My question is: is this possible? If so, what am I doing wrong?

I used the guide provided on the Mutt website. Like all good documentation, I cannot find it, but I will continue to look for it. Please do not hesitate to ask clarifying questions.


EDIT: ah darn, forgot password fields

1 Answer 1


From your description I understand Your company has some IDaaS provider for authentication. The best You can do is to use OAuth2. Maybe it could work also with Google application specific passwords, but it needs to be enabled in G Suite by administrators. Also Google started to sunset all other options then OAuth2 soon link.

Fortunately mutt and neomutt has OAuth2 support - see mutt or neomutt docs. The steps are the same, configuration should be also the same.

  • Download oauth2.py script from google/gmail-oauth2-tools repo, and make it executable
  • Create credentials
  • Generate refresh token

Finally put it all together in configuration.

set from = "[email protected]"
set realname = "Foo Barrington"

set smtp_url = "smtps://[email protected]@gmail.com"
set smtp_authenticators = "oauthbearer"
set smtp_oauth_refresh_command = "/path/to/oauth2.py --quiet \
  [email protected] \
  --client_id=CLIENT_ID \
  --client_secret=CLIENT_SECRET \

set smtp_authenticators = $smtp_authenticators
set imap_oauth_refresh_command = $smtp_oauth_refresh_command 

set folder = "imaps://[email protected]@imap.gmail.com:993/"
set spoolfile = +INBOX
set record "+[Gmail]/Sent Mail"
set postponed = "+[Gmail]/drafts"
set record = ""

Don't forget to change:

  • all occurrences of [email protected] to Your e-mail address,
  • /path/to/oauth2.py to path where keep it,
  • CLIENT_ID, CLIENT_SECRET and REFRESH_TOKEN with values you got while you were Creating credentials and Generating refresh token before - the steps from the mutt/neomutt docs.

Also keep your credentials and refreshtoken safe. Use some password manager and retrieve the passwords from there when starting mutt. See Mutt: how to safely store password?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .