3

Can anyone please help me.

i'm trying to configure the mutt in Ubuntu .I'm using the below configuration in muttrc :

set imap_user = "khalid@gmail.com"
set imap_pass = "PASS"
set smtp_url = "smtp://khalid@smtp.gmail.com:587/"
set smtp_pass = "PASS"
set from = "khalid@gmail.com"
set realname = "khalid khalid"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

while i am writing mutt in terminal i'm getting the below error:

login failed .

any solution for this please

1

6 Answers 6

10

The reason for the "Login failed" error may be the wrong password. If you have special symbols like "$" in your password, you should use single quotes:

set imap_pass = 'PassWith$Symbol'

Double quotes didn't help. To investigate causes of message "Login failed." you should enable debug by command:

mutt -d 5     

5 mean the most verbose output) Output could be founded in ~/.muttdebug0 file by default.

Debug possibility shoud be enabled. To check whether there is a parameter or not by this: mutt -v | grep DEBUG Output must be like this:

+DEBUG

I have same config file and tested it with gmail. It worked successfully.

1
  • Thanks a lot you saved me from giving up mutt because I couldn't login!
    – CocoaBean
    May 25, 2020 at 23:08
4
  1. Ensure you have enabled IMAP access in your Gmail account.
  2. Try with the following settings:

    set from      = khalid@gmail.com
    set realname  = "khalid khalid"
    set imap_user = khalid@gmail.com
    set imap_pass = PASS
    set smtp_url  = smtp://khalid@gmail.com@smtp.gmail.com:587/
    set smtp_pass = PASS
    
    set folder    = imaps://imap.gmail.com/
    set spoolfile = imaps://imap.gmail.com/INBOX
    set postponed = "+[Gmail]/Drafts"
    
    set header_cache     =~/.mutt/cache/headers
    set message_cachedir =~/.mutt/cache/bodies
    set certificate_file =~/.mutt/certificates
    
3
  • I put the above setting and I enabled IMAP access in my gmail also have turn on Access for less secure apps in gmail . but stile I'm getting the error: Login Failed . Nov 6, 2016 at 13:26
  • Can you include the following lines as well?: set ssl_starttls = yes set ssl_force_tls = yes
    – 1sloc
    Nov 6, 2016 at 16:08
  • 1
    I include the above two line , and again i'm getting the same error ... Is there any tutorial for mutt installation and configuration ? Nov 6, 2016 at 16:18
4

I also faced same issue. After Turning on "Less secure app access" in Google account settings, it started working.

hope it may help others.

0
3

I have the same issue, then I turn on Less secure app access https://myaccount.google.com/lesssecureapps then it works..

1
  • While this answer is probably helpful a little more information would be great. Maybe add some screenshots?
    – m02ph3u5
    Dec 1, 2019 at 19:47
2

I finally found a solution to this!

  • I first tried what @1sloc did by removing quotes.
  • I even used an App Password - Some forms stated that using an app password helped.
  • Another attempt I did was giving access to less secure apps. Use this link

Every time I debugged it with the code below

mutt -d 1

All I kept getting was Login Failed

Then I came across this link posted by Google. The last step is
what solved the problem. It told me to log in from the new device now and it finally worked!!!

It might be different for everyone but try all the above methods and see which one works for you. Also try using passwords without special characters @1sloc said. It might just solve your issue instantly

========================================================================

1
  • allowing less secure app access through gmail security settings fixed it for me. Feb 2, 2022 at 20:19
1

In case of accounts with 2FA (Second Factor) you can follow this simple guide

Basically, you should be able to generate 'application password' for gmail here

1
  • Yes, I believe that the problem of this thread comes from 2FA.
    – Pham
    Jun 17, 2022 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.