I have tried to configure mutt, but it won't login to Gmail. I copy and pasted the following into muttrc (with my own details), but it always says: Login failed.

Some people have said to change:

set smtp_url = "smtp://[user]@[email protected]:587/"


set smtp_url = "smtps://[user]@[email protected]:465/"

but it does not work for me. Any help is greatly appreciated.

set imap_user = "[user]@gmail.com"
set imap_pass = "[password]"
set smtp_url = "smtp://[user]@[email protected]:587/"
set smtp_pass = "[password]"
set from = "[user]@gmail.com"
set realname = "[User Name]"
set editor = "vim"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[Gmail]/Drafts"
set record = "+[Gmail]/Sent Mail"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set auto_tag = yes
hdr_order Date From To Cc
auto_view text/html
bind editor <Tab> complete-query
bind editor ^T complete
bind editor <space> noop
macro index,pager y "<enter-command>unset trash\n <delete-message>" "Gmail archive message"
macro index,pager d "<enter-command>set trash=\"imaps://imap.googlemail.com/[Gmail]/Bin\"\n <delete-message>" "Gmail delete message"
macro index,pager gl "<change-folder>"
macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
macro index,pager gt "<change-folder>=[Gmail]/Sent Mail<enter>" "Go to sent mail"

1 Answer 1


You're probably running into the problems encountered when you don't use application specific passwords https://support.google.com/mail/answer/1173270?hl=en

  • 1
    This works for me, even with 2-factor authentication (with this app specific password it doesn't use 2-factor, but for my other usages of the account). This is nice because they generate a password unrelated to your main google/gmail password which you can revoke whenever you want.
    – twolfe18
    Sep 16, 2015 at 3:48
  • 1
    This was working just fine for me a few weeks ago with an app password for my university O365 service over IMAP, but today it is rejecting that password (it has not changed, nor has my regular password). I generated another app password but mutt rejects that too. I know IMAP to that service works because I can bring it up in Tbird. Not sure where I should start looking... Jul 25, 2018 at 20:09

You must log in to answer this question.

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