---
title: Setup mutt with Gmail on CentOS and Ubuntu
updated: 2019-07-03 16:04:09Z
created: 2019-07-03 16:03:16Z
tags:
  - IT
  - IT/Tools/mutt
source: https://www.linux.com/blog/setup-mutt-gmail-centos-and-ubuntu
---

[Setup mutt with Gmail on CentOS and Ubuntu](https://www.linux.com/blog/setup-mutt-gmail-centos-and-ubuntu)
**Gmail Setup**

In gmail, go click the gear icon, go to `Settings`, go to the tab `Forwarding POP/IMAP`, and click the `Configuration instructions` link in `IMAP Access` row.

Then click `I want to enable IMAP`. At the bottom of the page, under the paragraph about configuring your mail client, select `Other`. Note the mail server information and use that information for further settings as shown in the next section.

Before proceeding further visit [](https://www.google.com/settings/security/lesssecureapps)[https://www.google.com/settings/security/lesssecureapps](https://www.google.com/settings/security/lesssecureapps) and check`Turn on` radio button.

**Install mutt**

_CentOS_

```shell
yum install mutt
```

_Ubuntu_

```shell
sudo apt-get install mutt
```

**Configure Mutt**

Create

```shell
mkdir -p ~/.mutt/cache/headers
mkdir ~/.mutt/cache/bodies
touch ~/.mutt/certificates
```

Create mutt configuration file `muttrc`

```shell
touch ~/.mutt/muttrc
```

Open muttrc

```shell
vim ~/.mutt/muttrc
```

Add following configurations

```shell
set ssl_starttls=yes
set ssl_force_tls=yes
set imap_user = 'This e-mail address is being protected from spambots. You need JavaScript enabled to view it'
set imap_pass = 'PASSWORD'
set from='This e-mail address is being protected from spambots. You need JavaScript enabled to view it'
set realname='Your Name'
set folder = imaps://imap.gmail.com/
set spoolfile = imaps://imap.gmail.com/INBOX
set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
set smtp_url = 'smtps://This e-mail address is being protected from spambots. You need JavaScript enabled to view it:This e-mail address is being protected from spambots. You need JavaScript enabled to view it:465/'
set move = no
set imap_keepalive = 900
```

Make appropriate changes, like `change_this_user_name` to your gmail user name and `PASSWORD` to your gmail password. And save the file.

Now you are ready to send, receive and read email using email client Mutt by simply typing `mutt`.

For the first time it will prompt to accept SSL certificates; press `a` to always accept these certificates.

Now you will be presented with your Gmail inbox.
