Using Mutt to access gmail via imap

1941 views
Skip to first unread message

fred....@gmail.com

unread,
Mar 14, 2015, 3:57:19 PM3/14/15
to
Hi all!

According to the mutt help pages it should be possible (seemingly easy)
to use mutt to browse my gmail inbox.

I've enabled imap at gmail and tried every permutation I can think of
to log in from mutt, similar to this:

using the 'c' command, enter:

imaps://<my gmail username>@imap.gmail.com:933/<my gmail username>

and lots of variants.

If I'm lucky, and it doesn't just time out waiting for something,...
or instantly say "login failed", it will ask for username then password,
then reject the login.

for username I've tried <my gmail username>
or <my gmail username>@gmail.com
or <my gmail username>@imap.gmail.com
or other variants.

nothing actually works.

a few times I've not had errors, but ended up at an empty screen that
should show email, but at the bottom it says "no mailbox".

I'm kinda at a loss as to how to proceed and would appreciate any
guidance that any of you can offer.

BTW, this is mutt 1.5.20-7.20091214hg736b6a.el6.x86_64, the stock
mutt for Centos-6.

Thanks in advance!

Fred

Phil Boutros

unread,
Mar 14, 2015, 4:34:20 PM3/14/15
to
fred....@gmail.com <fred....@gmail.com> wrote:
> Hi all!
>
> According to the mutt help pages it should be possible (seemingly easy)
> to use mutt to browse my gmail inbox.

Try setting these in your .muttrc:

set imap_user = "yourus...@gmail.com"
set imap_pass = "yourpass"
set smtp_url = "smtp://yourus...@smtp.gmail.com:587/"
set smtp_pass = "yourpass"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed

Obviously, replace yourusername and yourpassword with your own.
Be aware that, if you're using two-factor authentication with Gmail,
you'll have to create an application-specific password.


Phil
--
AH#61 Wolf#14 BS#89 bus#1 CCB#1 SENS KOTC#4 ph...@philb.ca
http://philb.ca EKIII rides with me: http://eddiekieger.com

fred....@gmail.com

unread,
Mar 14, 2015, 11:31:00 PM3/14/15
to
hey Phil, thanks for the info. I'll be giving that a try Real Soon Now.

Fred

fred....@gmail.com

unread,
Mar 15, 2015, 3:47:51 PM3/15/15
to
On Saturday, March 14, 2015 at 4:34:20 PM UTC-4, Phil Boutros wrote:
Hi Phil!

I put those lines in my .muttrc (making changes as you suggested) and when I started up mutt it spewed some RED messages too fast to read, paused, then said
"login failed" also in red. pretty much the same as some of my earlier attempts.

I'm guessing there's something special about google w/imap that I don't understand. or maybe my mutt binary is missing some compile-time option (it's the standard mutt from Centos-6), though when run as "mutt -v" it does show "+USE_IMAP", so I'd think it should work.

Any other ideas?

Thanks again!

Javier

unread,
Mar 15, 2015, 6:44:42 PM3/15/15
to
> Hi Phil!
> I put those lines in my .muttrc (making changes as you suggested)
> and when I started up mutt it spewed some RED messages too fast to
> read, paused, then said "login failed" also in red. pretty much the
> same as some of my earlier attempts.

This is what I use myself. They are a bit different to Phil's. My
recommendation is not to use gmail. You will get disconnected
sometimes from the imap server for no reason (gmail doesn't seem to
follow well the imap standard for timeouts). Also their spam filter
is too agressive and you will need to check the spam folder from time
to time to look for legitimate mail.

Are you using any non-alphanumeric character in your password? That
might be a reason it doesn't work

########################################################
set folder="imaps://user...@imap.gmail.com:993/"
set spoolfile="+INBOX"
set imap_user = "username"
set imap_pass = XXXXXXXXXXXXXX

set smtp_url="smtp://user...@smtp.gmail.com:587/"
set smtp_pass="XXXXXXXXXXXXXX"
#####################################################

Phil Boutros

unread,
Mar 16, 2015, 11:21:25 AM3/16/15
to
fred....@gmail.com <fred....@gmail.com> wrote:
>
> I put those lines in my .muttrc (making changes as you suggested) and when I started up mutt it spewed some RED messages too fast to read, paused, then said
> "login failed" also in red. pretty much the same as some of my earlier attempts.
<snip>
> Any other ideas?

Without knowing what the "stuff in red" is, it's rather difficult.
Keep in mind that Gmail does not allow that many concurrent
connections. If you already are connected on a phone, perhaps another
browser, etc, then the login will fail.

Grant Edwards

unread,
Mar 16, 2015, 12:18:52 PM3/16/15
to
On 2015-03-16, Phil Boutros <ph...@philb.ca> wrote:
> fred....@gmail.com <fred....@gmail.com> wrote:
>>
>> I put those lines in my .muttrc (making changes as you suggested) and when I started up mutt it spewed some RED messages too fast to read, paused, then said
>> "login failed" also in red. pretty much the same as some of my earlier attempts.
><snip>
>> Any other ideas?
>
> Without knowing what the "stuff in red" is, it's rather difficult.
> Keep in mind that Gmail does not allow that many concurrent
> connections. If you already are connected on a phone, perhaps
> another browser, etc, then the login will fail.

I regularly have 5-6 concurrent sessions, and have never noticed a
problem. Many of them stay up for weeks at a time (AFAICT).

--
Grant Edwards grant.b.edwards Yow! My polyvinyl cowboy
at wallet was made in Hong
gmail.com Kong by Montgomery Clift!

Phil Boutros

unread,
Mar 16, 2015, 7:25:42 PM3/16/15
to
Grant Edwards <inv...@invalid.invalid> wrote:
>
> I regularly have 5-6 concurrent sessions, and have never noticed a
> problem. Many of them stay up for weeks at a time (AFAICT).

Are they all via IMAP? It also depends how many folders you
subscribe to. You only get 15 concurrent IMAP connections *total*.

Source: https://support.google.com/mail/answer/97150?hl=en

Grant Edwards

unread,
Mar 16, 2015, 9:04:52 PM3/16/15
to
On 2015-03-16, Phil Boutros <ph...@philb.ca> wrote:
> Grant Edwards <inv...@invalid.invalid> wrote:
>>
>> I regularly have 5-6 concurrent sessions, and have never noticed a
>> problem. Many of them stay up for weeks at a time (AFAICT).
>
> Are they all via IMAP?

Yes.

> It also depends how many folders you subscribe to.

I'm not sure what "subscribing" to a folder means. I only monitor the
inbox, but my mutt knows about the other 50+ mailboxes.

> You only get 15 concurrent IMAP connections *total*.
>
> Source: https://support.google.com/mail/answer/97150?hl=en

Yep, and 5 or 6 is definitely less than 15.

--
Grant




Phil Boutros

unread,
Mar 17, 2015, 11:47:04 AM3/17/15
to
Grant Edwards <inv...@invalid.invalid> wrote:
>
>> It also depends how many folders you subscribe to.
>
> I'm not sure what "subscribing" to a folder means. I only monitor the
> inbox, but my mutt knows about the other 50+ mailboxes.

But it probably doesn't update them or their count until you open
them. If you subscribe to them, it keeps track of any new messages in
them at all times, but it costs you a connection in many cases.

>> You only get 15 concurrent IMAP connections *total*.
>>
>> Source: https://support.google.com/mail/answer/97150?hl=en
>
> Yep, and 5 or 6 is definitely less than 15.

Correct, if you're only checking the Inbox. Many of us make
extensive use of filtering to parse various messages into various
folders, which then require being subscribed to.

This may or may not be the OP's problem, just thought I'd throw it
out there.

Grant Edwards

unread,
Mar 18, 2015, 11:40:24 AM3/18/15
to
On 2015-03-17, Phil Boutros <ph...@philb.ca> wrote:
> Grant Edwards <inv...@invalid.invalid> wrote:
>>
>>> It also depends how many folders you subscribe to.
>>
>> I'm not sure what "subscribing" to a folder means. I only monitor the
>> inbox, but my mutt knows about the other 50+ mailboxes.
>
> But it probably doesn't update them or their count until you open
> them. If you subscribe to them, it keeps track of any new messages
> in them at all times, but it costs you a connection in many cases.

Thanks for the explanation.

>>> You only get 15 concurrent IMAP connections *total*.
>>>
>>> Source: https://support.google.com/mail/answer/97150?hl=en
>>
>> Yep, and 5 or 6 is definitely less than 15.
>
> Correct, if you're only checking the Inbox.

That is indeed the case in my configuration. I have a GTK
notification app that keeps 1 connection open (that app is always
running on 2 and sometimes 3 different machines, but it's only
watching the Inbox). Then I often have 3-4 instances of mutt open,
but in each case, I only have one "inbox" configured.

> Many of us make extensive use of filtering to parse various messages
> into various folders, which then require being subscribed to.
>
> This may or may not be the OP's problem, just thought I'd throw it
> out there.

--
Grant Edwards grant.b.edwards Yow! Quick, sing me the
at BUDAPEST NATIONAL ANTHEM!!
gmail.com

andrzejpo...@gmail.com

unread,
Apr 13, 2015, 3:20:24 PM4/13/15
to
> Using Mutt to access gmail via imap
>
> From: fred....@gmail.com
> Reply to: fred....@gmail.com
> Date: Sat, 14 Mar 2015 12:57:19 -0700 (PDT)
> NNTP Agent: Lynx 2.8.6rel4 for Coherent
> Newsgroups:
> comp.mail.mutt
> Followup to: newsgroup
>Hi all!
>
>According to the mutt help pages it should be possible (seemingly easy)
>to use mutt to browse my gmail inbox.
>
>I've enabled imap at gmail and tried every permutation I can think of
>to log in from mutt, similar to this:
>
>using the 'c' command, enter:
>
> imaps://<my gmail username>@imap.gmail.com:933/<my gmail username>
>
>and lots of variants.
>
>
>Fred

Hi
Here is my muttrc file. I have two imap accounts.
The example contains only imap oriented lines.

BEGIN

set imap_authenticators="sasl:cram-md5:plain:login"

folder-hook "imaps://imap.amu.edu.pl/" set imap_user="apopiele"
folder-hook "imaps://imap.amu.edu.pl/" set imap_pass="xxxxx"
folder-hook "imaps://imap.amu.edu.pl/" set folder="imaps://imap.amu.edu.pl/"



folder-hook "imaps://imap.googlemail.com/" set imap_pass="xxx"
folder-hook "imaps://imap.googlemail.com/" set imap_user="andrzejpopielewicz"
folder-hook "imaps://imap.googlemail.com/" set folder="imaps://imap.googlemail.com"

set imap_passive=yes

folder-hook "imap.amu.edu.pl" my_hdr From: apop...@amu.edu.pl
folder-hook "imap.googlemail.com" my_hdr From: andrzejpo...@gmail.com
folder-hook "smtp.googlemail.com" my_hdr From: andrzejpo...@gmail.com


folder-hook "imap.amu.edu.pl" my_hdr Reply-To: apop...@amu.edu.pl
folder-hook "imap.googlemail.com" my_hdr Reply-To: andrzejpo...@gmail.com
folder-hook "smtp.googlemail.com" my_hdr Reply-To: andrzejpo...@gmail.com


folder-hook "imap.amu.edu.pl" set ssl_use_tlsv1_2=yes

folder-hook "imap.amu.edu.pl" \
set smtp_url="smtps://Youruser:Your...@imap.amu.edu.pl:465"

folder-hook "imap.googlemail.com" set ssl_use_tlsv1_2=yes

folder-hook "imap.googlemail.com" \
set smtp_url="smtps://YourUser:Your...@smtp.googlemail.com:465"

folder-hook "smtp.googlemail.com" set ssl_use_tlsv1_2=yes
END

HTH
I am using usually the command

mutt -f imaps://imap.googlemail.com/

Andrzej

andrzejpo...@gmail.com

unread,
Apr 13, 2015, 3:48:46 PM4/13/15
to

Perhaps some more details will be helpful

mutt version 1.5.22
gsasl-1.3
openssl-1.0.1h

Andrzej

andrzej Popielewicz

unread,
Apr 14, 2015, 5:09:28 AM4/14/15
to
W dniu 2015-04-13 o 21:48, andrzejpo...@gmail.com pisze:
Oops. Sorry, I am using cyrus-sasl-2.1.25 , NOT gsasl.
BTW If You want use smtp You have to enable SASL during configure process.

Andrzej
Reply all
Reply to author
Forward
0 new messages