# Configuration for mutt with Gmail account



## Spartrekus (Mar 15, 2018)

Hello, It might be a bit off-topic, but anyhow. Would you have a good .muttrc configuration that you may recommend (for IMAP/Gmail account)?

I was actually thinking about using Gmail and mutt, leaving on my left monitor running mutt to see new emails.

I may share my present .muttrc configuration if you'd like. 

Best regards


----------



## rigoletto@ (Mar 15, 2018)

The basic difference of using a gmail account and other accounts are the need to specify the user name using the complete e-mail adress for gmail ones.

This is mine for mail/neomutt:


```
### General ###
set timeout            = 30
set sleep_time             = 0
set fast_reply            = yes
set include            = yes
set use_from            = yes
set reverse_name        = yes
set mail_check_stats        = yes
set mail_check_stats_interval    = 30

set sort            = threads
set strict_threads        = yes
set sort_browser        = reverse-date
set sort_aux            = last-date-received

set pager_context        = 3
set pager_stop            = yes

set editor            = "nvim -c 'set tw=80 fo=t' %s"

set sidebar_visible        = yes
set sidebar_short_path        = yes
set sidebar_folder_indent    = yes
set sidebar_delim_chars        = "/"
set sidebar_indent_string    = "  "
set sidebar_format         = "%B%?F? [%F]?%* %?N?%N/?%S"

set send_charset        = "utf-8"
set assumed_charset        = "iso-8859-1"

set hostname            = "YOURHOSTNAME"

set abort_noattach         = no
set attach_keyword         = "\\<attach(|ed|ments?)\\>"

set header_cache_backend    = lmdb
set header_cache        = $HOME/.cache/neomutt/headers

set mailcap_path        = $HOME/.config/neomutt/mailcap

auto_view text/html
alternative_order text/plain text/html


#set new_mail_command    = "notify-send 'New Email' 'for YOU' &"


### Set Custom Key Bindings ###
bind index D purge-message

bind index,pager \CP sidebar-prev       # Ctrl-Shift-P - Previous Mailbox
bind index,pager \CN sidebar-next       # Ctrl-Shift-N - Next Mailbox
bind index,pager \CO sidebar-open       # Ctrl-Shift-O - Open Highlighted Mailbox


### Accounts ###
source ~/path/to/account/file


### Coloring ###
source $HOME/.config/neomutt/colours
```

Account file:


```
### General Settings ###
set mbox_type         = Maildir
set folder        = $HOME/.mail

set spoolfile         = '+INBOX'
set postponed         = '+Drafts'
set record         = '+Sent'
set trash        = '+Trash'

mailboxes    "+-- ACCOUNT NAME --------" \
    +INBOX +Blackhole +Drafts +Duplicates \
    +FreeBSD \
        +FreeBSD/Advocacy +FreeBSD/Announce +FreeBSD/Bugs \
        +FreeBSD/Current +FreeBSD/Hackers +FreeBSD/IPFW +FreeBSD/Ports \
        +FreeBSD/Ports-Announce +FreeBSD/Security-Notifications \
    +Github +Sent +Spam +Private +Trash

timeout-hook 'exec sync-mailbox'
startup-hook 'exec sync-mailbox'
shutdown-hook 'exec sync-mailbox'


source $HOME/.config/neomutt/gpg.rc


### SMTP Settings ###
source "gpg2 -qd /path/to/encrypted/passwd/file.gpg |"

set my_user        = someuser@domain.com
set smtp_url        = smtps://$my_user:$my_pass@smtp.yandex.com/
set ssl_starttls    = yes
set ssl_force_tls     = yes
set use_from         = yes


### Account Settings ###
set from         = 'someuser@domain.com'
set realname         = 'YOUR NAME'
set signature        = ''
```

You may want to use mail/mutt together with mail/fdm for filtering.


----------



## shepper (Mar 15, 2018)

There are quite a few howto's on the Web
mutt + gmail.


----------



## Harmnot (Mar 16, 2018)

lebarondemerde said:


> The basic difference of using a gmail account and other accounts are the need to specify the user name using the complete e-mail adress for gmail ones.
> 
> This is mine for mail/neomutt:
> 
> ...



I was wanted to ask about that question before ,
I get failed to send email on mutt, it said sal failed to connect smtp, I use currently port of SMTP though on muttrc, is there something wrong ? Or I should setting on my openssl?


----------



## scottro (Mar 16, 2018)

My mutt page mentions setting up msmtp for gmail if that helps.  http://srobb.net/mutt.html   (Just search for gmail on the page, it mentions it in getmail, msmtp, a very flexible mail sender, or just putting it in .muttrc.)


----------

