Gmail and mutt at the command line

Tim Chase blinux.list at thechases.com
Fri May 27 15:53:23 UTC 2016


On 2016-05-27 10:02, John J. Boyer wrote:
> Can I use gmail with mutt at the command line? Will it appear like
> messages usually do in mutt?

Yes, you should be able to use Gmail's IMAPS and SMTPS servers within
Mutt.  You might need a local MTA such as sendmail or "msmtp" that
can talk to Google's SMTP server.  You may also need the standard
suite of CA certificates though you should likely already have that
installed.  If not, something like

   sudo apt-get install msmtp openssl ca-certificates

Making the following assumptions:

  - you correctly have the above installed
  - your certs end up in /etc/ssl/certs/ca-certificates.crt
  - your username is "examplejohn at gmail.com"
  - your password is "MySecretPassword"

you can configure it to send mail using gmail with the following in
your ~/.msmtprc file:

   account default
   host smtp.gmail.com
   port 587
   from "examplejohn at gmail.com"
   tls on
   tls_starttls on
   tls_trust_file /etc/ssl/certs/ca-certificates.crt
   auth on
   user "examplejohn"
   password "MySecretPassword"
   logfile ~/.msmtp.log

Then your ~/.muttrc you want something like

  set imap_user = 'examplejohn at gmail.com'
  set imap_pass = 'MySecretPasswordd'
  set spoolfile = imaps://imap.gmail.com/INBOX
  set folder = imaps://imap.gmail.com/
  set record=""
  #set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
  set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"

and you may want

  bind editor <space> noop

if your Gmail folders have spaces in their names.

There's a bit more on the Mutt wiki:

  https://dev.mutt.org/trac/wiki/UseCases/Gmail

but the page was being unresponsive when I tested it just now.

-tim






More information about the Blinux-list mailing list