Skip to content

Instantly share code, notes, and snippets.

@jamm1985
Last active Aug 23, 2021
Embed
What would you like to do?
Mutt configuration file with multiple gmail accounts (mbsync), folders, sidebar and notmuch mail search
# import secrets
source "gpg -dq $HOME/.mutt/pwd_file.txt.gpg |"
# mailbox type
set mbox_type = Maildir
# read/new is good enough for me
unset mark_old
# insert the user aget header
set user_agent
# download folder
macro attach s <save-entry><bol>/Users/jamm/Downloads/mail/<eol>
# default account to use
source "~/.mutt/gmail-home.rc"
# home gmail account config
folder-hook /Users/jamm/Mail/Gmail-myjamm/* "source ~/.mutt/gmail-home.rc"
# work gmail account config
folder-hook /Users/jamm/Mail/Gmail-gft/* "source ~/.mutt/gmail-work.rc"
# How often to check for new mail (time in seconds). Comment it if you have a lot of folders
#set mail_check = 120
#set timeout = 300
#mailboxes to sidebar
#search`mailboxes: `find ~/Mail -type d -name cur -printf '%h '``
# mailboxes ="------------Work------------"
mailboxes = /Users/jamm/Mail/Gmail-gft/inbox-gft/
#mailboxes = -label Importants "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BB8EPgQ8BDUERwQ1BD0EPQRLBDU-"
mailboxes = -label "Sent/" "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-"
mailboxes = -label "Spam_/" "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BCEEPwQwBDw-/"
mailboxes = -label "All Mail/" "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BBIEQQRP- &BD8EPgRHBEIEMA-/"
mailboxes = -label "Drafts/" "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BCcENQRABD0EPgQyBDgEOgQ4-/"
mailboxes = -label "Trash/" "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BBoEPgRABDcEOAQ9BDA-/"
mailboxes = /Users/jamm/Mail/Gmail-gft/Bill/ /Users/jamm/Mail/Gmail-gft/trello/ /Users/jamm/Mail/Gmail-gft/Docs/ /Users/jamm/Mail/Gmail-gft/Groups/
mailboxes ="------------Home------------"
mailboxes = "/Users/jamm/Mail/Gmail-myjamm/inbox/"
mailboxes = "/Users/jamm/Mail/Gmail-myjamm/[Gmail]/Sent Mail/" "/Users/jamm/Mail/Gmail-myjamm/[Gmail]/Spam/" "/Users/jamm/Mail/Gmail-myjamm/[Gmail]/All Mail/" "/Users/jamm/Mail/Gmail-myjamm/[Gmail]/Drafts/"
mailboxes = /Users/jamm/Mail/Gmail-myjamm/Myfolder/ /Users/jamm/Mail/Gmail-myjamm/Myfolder/bill&-inform/
mailboxes = /Users/jamm/Mail/Gmail-myjamm/Community/ /Users/jamm/Mail/Gmail-myjamm/Community/CI_CD/ /Users/jamm/Mail/Gmail-myjamm/Community/julialang/
mailboxes = /Users/jamm/Mail/Gmail-myjamm/Science/ /Users/jamm/Mail/Gmail-myjamm/Science/edx/ /Users/jamm/Mail/Gmail-myjamm/Science/Support/ /Users/jamm/Mail/Gmail-myjamm/Science/seislists/
mailboxes = /Users/jamm/Mail/Gmail-myjamm/soc/
mailboxes = /Users/jamm/Mail/Gmail-myjamm/Finance/
mailboxes = /Users/jamm/Mail/Gmail-myjamm/Companies/ /Users/jamm/Mail/Gmail-myjamm/Companies/Public/ # /Users/jamm/Mail/Gmail-myjamm/Companies/IMedia/ /Users/jamm/Mail/Gmail-myjamm/Companies/IMedia/support/ /Users/jamm/Mail/Gmail-myjamm/Companies/Arsenal-Media/ /Users/jamm/Mail/Gmail-myjamm/Companies/Arsenal-Media/Support/ /Users/jamm/Mail/Gmail-myjamm/Companies/Arsenal-Media/Redmine/
mailboxes = "/Users/jamm/Mail/Gmail-myjamm/Trash/"
# cache options
set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
# fix backspace key binding for previous-line
# infocmp > xterm-256color.src
# changed kbs=^H to kbs=\177, then
# tic -x xterm-256color.src
# Ask before quitting, but default to yes
set quit=ask-no
# sidebar
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
# B toggles sidebar visibility
macro index \CB '<enter-command>toggle sidebar_visible<enter><refresh>'
macro pager \CB '<enter-command>toggle sidebar_visible<enter><redraw-screen>'
# mark all as read
macro index A \
"<tag-pattern>~N<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" \
"mark all new as read"
# other sidebar settings
set sidebar_visible = yes
set sidebar_width = 30
set sidebar_short_path = yes
set sidebar_folder_indent = yes
set mail_check_stats
set mail_check_stats_interval = 300
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?'
set sidebar_divider_char = "| "
set sidebar_sort_method = unsorted
# attachments
set rfc2047_parameters
# adress book
set query_command="lbdbq '%s'"
# colors
source "~/.mutt/colors/mutt-colors-solarized-dark-256.muttrc"
# editor without autowrapping
set editor="vim +':set textwidth=0' +':set wrapmargin=0' +':set wrap'"
# attachments
set mailcap_path =~/.mutt/mailcap
# html emails
auto_view text/enriched text/html
alternative_order text/plain text/enriched text/html
# view links in browser
#macro pager \cb <pipe-entry>'urlview'<enter> 'Follow links with urlview'
# Index View Options
set date_format = "!%a, %d %b %Y %H:%M %Z"
set index_format="%2C | %Z [%D] %-30.30F (%-4.4c) %M %s"
#set pager_format="-%Z- %C/%m: %-20.20n %s%* -- (%P)"
set pager_index_lines=10
set pager_stop=yes
set sort = threads # like gmail
set sort_aux = reverse-last-date-received # like gmail
folder-hook . "push \eV"
set uncollapse_jump # don't collapse on an unread message
set forward_format = "Fw: %s"
# search email using notmuch-mutt
macro index,pager <F8> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<shell-escape>notmuch-mutt -r --prompt search<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuch: search mail"
macro index,pager <F9> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuch-mutt -r thread<enter>\
<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuch: reconstruct thread"
# macro index <F6> \
# "<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
# <pipe-message>notmuch-mutt tag -- -inbox<enter>\
# <enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
# "notmuch: remove message from inbox"
# myjamm@gmail.com
set realname = "Andrey Stepnov"
set from = "myjamm@gmail.com"
set use_from = yes
set envelope_from = yes
# mailbox configuration
set spoolfile = "~/Mail/Gmail-myjamm/inbox"
set postponed = "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BCcENQRABD0EPgQyBDgEOgQ4-/"
# SMTP config
set smtp_url = "smtps://myjamm@gmail.com@smtp.gmail.com:465"
set smtp_pass = $my_myjamm
set record = ""
set ssl_force_tls = yes
set smtp_authenticators = 'gssapi:login'
# a.stepnov@geophystech.ru
set realname = "Andrey Stepnov"
set from = "a.stepnov@geophystech.ru"
set use_from = yes
set envelope_from = yes
# mailbox configuration
set spoolfile = "~/Mail/Gmail-gft/inbox-gft"
set postponed = "/Users/jamm/Mail/Gmail-gft/[Gmail]/&BCcENQRABD0EPgQyBDgEOgQ4-/"
# SMTP config
set smtp_url = "smtps://a.stepnov@geophystech.ru@smtp.gmail.com:465"
set smtp_pass = $my_gft
set record = ""
set ssl_force_tls = yes
set smtp_authenticators = 'gssapi:login'
MAPAccount personal
Host imap.gmail.com
User myjamm@gmail.com
Pass "*****************"
SSLType IMAPS
CertificateFile /usr/local/etc/openssl@1.1/cert.pem
AuthMechs PLAIN
# Throttle mbsync so we don't go over gmail's quota: OVERQUOTA error would
# eventually be returned otherwise. For more details see:
# https://sourceforge.net/p/isync/mailman/message/35458365/
PipelineDepth 50
IMAPStore personal-remote
Account personal
MaildirStore personal-local
Subfolders Verbatim
Path ~/Mail/Gmail-myjamm/
Inbox ~/Mail/Gmail-myjamm/inbox
Channel personal-default
Far :personal-remote:
Near :personal-local:
Patterns *
Create Both
SyncState *
Sync All
IMAPAccount work
Host imap.gmail.com
User a.stepnov@geophystech.ru
Pass "*****************"
SSLType IMAPS
CertificateFile /usr/local/etc/openssl@1.1/cert.pem
AuthMechs PLAIN
# Throttle mbsync so we don't go over gmail's quota: OVERQUOTA error would
# eventually be returned otherwise. For more details see:
# https://sourceforge.net/p/isync/mailman/message/35458365/
PipelineDepth 50
IMAPStore work-remote
Account work
MaildirStore work-local
Subfolders Verbatim
Path ~/Mail/Gmail-gft/
Inbox ~/Mail/Gmail-gft/inbox-gft
Channel work-default
Far :work-remote:
Near :work-local:
Patterns *
Create Both
SyncState *
Sync All
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment