Neomutt

Neomutt on MacOS

Overview

neomutt只是处理本地已经同步下来的邮件文件

  • 用于发信需要安装 msmtp
  • 用于IMAP同步邮件需要安装 mbsyc (在homebrew下安装isync)
  • 用于查找macOS上联系人信息需要安装 contacts

命令

# 同步IMAP邮件
mbsync -a

# 启动neomutt
neomutt

mbsync 配置

SyncState *
#Sync New ReNew Flags

IMAPAccount lab
Host lab.henryzhou.com
User [email protected]
PassCmd "gpg2 -q --no-tty -d ~/.mailpass/lab.gpg"
SSLType IMAPS

IMAPStore lab-remote
Account lab

MaildirStore lab-local
Subfolders Verbatim
Path ~/.mail/lab/
Inbox ~/.mail/lab/Inbox
#Trash ~/.mail/lab/Trash

Channel lab
Master :lab-remote:
Slave :lab-local:
Patterns *

Create Both
Expunge Both

neomutt 配置

set realname = "Henry Zhou"

set from="[email protected]"
set sendmail = "/usr/local/homebrew/bin/msmtp -a lab"
set query_command ="/usr/local/homebrew/bin/contacts -m %s"

# GPG
set crypt_autosign = yes
set crypt_verify_sig = yes
set crypt_use_gpgme = yes
set crypt_replysign = yes
set crypt_replyencrypt = yes


# Path
set mbox_type      = "Maildir"
set folder         = "~/.mail"
set spoolfile      = "+lab/Inbox"
set header_cache = ~/.mutt/cache/headers
set message_cachedir = ~/.mutt/cache/bodies
set tmpdir = ~/.mutt/tmp
set mailcap_path = ~/.mutt/mailcap
set postponed      = "+lab/Drafts"
set record         = "+lab/Sent"
set trash          = "+lab/Trash"

set delete
set quit=ask-yes
set mail_check_stats

# compose View Options
set envelope_from                    # which from?
set edit_headers                     # show headers when composing
set fast_reply                       # skip to compose when replying
set askcc                            # ask for CC:
set fcc_attach                       # save attachments with the body
set forward_format = "Fwd: %s"       # format of subject when forwarding
set forward_decode                   # decode when forwarding
set attribution = "On %d, %n wrote:" # format of quoting header
set reply_to                         # reply to Reply to: field
set reverse_name                     # reply as whomever it was to
set include                          # include message in replies
set forward_quote                    # include message in forwards
set editor = "vim"
set text_flowed
unset sig_dashes                     # no dashes before sig
unset mime_forward                   # forward attachments as part of body

# status bar, date format, finding stuff etc.
set status_chars = " *%A"
set status_format = "[ Folder: %f ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>─%?p?( %p postponed )?"
set date_format = "%d.%m.%Y %H:%M"
set index_format = "[%Z] %?X?A&-? %D  %-20.20F  %s"
set sort = threads
set sort_aux = reverse-last-date-received
set uncollapse_jump
set sort_re
set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
set send_charset = "utf-8:iso-8859-1:us-ascii"
set charset = "utf-8"

# Pager View Options
set pager_index_lines = 10
set pager_context = 3
set pager_stop
set menu_scroll
set tilde
unset markers

# email headers and attachments
ignore *
unignore from: to: cc: bcc: date: subject:
unhdr_order *
hdr_order from: to: cc: bcc: date: subject:
alternative_order text/plain text/enriched text/html
auto_view text/html

# sidebar patch config
set sidebar_visible
set sidebar_short_path
set sidebar_folder_indent
set sidebar_width = 25
set sidebar_divider_char = ' | '
set sidebar_indent_string = '  ''
set sidebar_format = "%B %* [%?N?%N / ?%S]"
# Toggle the visibility of the Sidebar
bind index,pager B sidebar-toggle-visible
# message counts for each mailbox.
set mail_check_stats

# Mailboxes to show in the sidebar.
#named-mailboxes =ALL-INBOXES
named-mailboxes "Inbox" =lab/Inbox
#mailboxes ="==================="
#named-mailboxes =lab =lab/Sent =lab/Drafts =lab/Starred =lab/Trash
named-mailboxes "Sent" =lab/Sent
named-mailboxes "Drafts" =lab/Drafts
named-mailboxes "Trash" =lab/Trash

# some sane vim-like keybindings
bind index,pager k previous-entry
bind index,pager j next-entry
bind index,pager g noop
bind index,pager \Cu half-up
bind index,pager \Cd half-down
bind pager gg top
bind index gg first-entry
bind pager G bottom
bind index G last-entry

# Sidebar Navigation
bind index,pager <down> sidebar-next
bind index,pager <up> sidebar-prev
bind index,pager <right> sidebar-open

# global index and pager shortcuts
bind index,pager @ compose-to-sender
bind index,pager R group-reply
bind index,pager D purge-message
bind index <tab> sync-mailbox
bind index <space> collapse-thread

# Sync all email
macro index,pager O "<shell-escape>mbsync -a<enter>" "run mbsync to sync all mail"

# Search
macro index <F7> "<shell-escape>mu find --format=links --linksdir=~/.mu/results --clearlinks "    "mu find"
macro index <F8> "<change-folder-readonly>~/.mu/results\n"       "display mu find results"

# Color
source ~/.mutt/colors

neomutt 配色

# basic colors ---------------------------------------------------------
color normal        white           default
color error         red             default
color tilde         black           default
color message       cyan            default
color markers       red             white
color attachment    white           default
color search        brightmagenta   default
color indicator     brightblack     yellow
color tree          green           default

# sidebarh
color sidebar_new   default blue

# index ----------------------------------------------------------------

color index         red             default         "~A"    # all messages
color index         brightred       default         "~E"    # expired messages
color index         blue            default         "~N"    # new messages
color index         blue            default         "~O"    # old messages
color index         brightmagenta   default         "~Q"    # messages that have been replied to
color index         brightwhite     default         "~R"    # read messages
color index         blue            default         "~U"    # unread messages
color index         brightyellow    default         "~v"    # messages part of a collapsed thread
color index         brightyellow    default         "~P"    # messages from me
color index         red             default         "~F"    # flagged messages
color index         black           red             "~D"    # deleted messages

# message headers ------------------------------------------------------

color hdrdefault    brightgreen     default
color header        brightyellow    default         "^(From)"
color header        blue            default         "^(Subject)"

# body -----------------------------------------------------------------

color quoted        blue            default
color quoted1       cyan            default
color quoted2       yellow          default
color quoted3       red             default
color quoted4       brightred       default

color signature     brightblack     default
color bold          black           default
color underline     black           default
color normal        default         default