1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# references:
# https://github.com/LukeSmithxyz/mutt-wizard
# https://wiki.archlinux.org/title/Mutt
# https://videos.lukesmith.xyz/
# https://docs.kernel.org/process/email-clients.html
# https://blog.flaport.net/configuring-neomutt-for-email.html
# maybe useful:
# `man neomuttrc`
# `man neomutt`
# /etc/neomutt
# https://neomutt.org/guide/gettingstarted.html
# /usr/share/doc/neomutt/optionalfeatures.html
# has hotkey documentation:
# /usr/share/doc/neomutt/manual.txt
# realname and spoolfile deprecated, use real_name and spool_file, also some other variable names, see:
# https://github.com/neomutt/neomutt/commit/a5eaeb51b14c484fa52f6f519446253dea5667ca
source mail2
# maybe useful for multiple accounts
#folder-hook $folder 'source mail2'
source mail
#folder-hook $folder 'source mail'
# note the imaps:// and smtps://, maybe more secure?
# note: xyz@flylightning.xyz will not work, need mail.flylightning.xyz, maybe because they require the actual imaps and smtps email server DNS
#set smtp_url='smtps://xyz@mail.flylightning.xyz'
# mbox_type not sure if needed, maybe needed because isync/mbsync set to use maildir format
set mbox_type=Maildir
#set folder="$XDG_DATA_HOME/mail/xyz@mail.flylightning.xyz"
# if fully online and not using mbsync:
#set folder='imaps://xyz@mail.flylightning.xyz'
# https://wiki.archlinux.org/title/Mutt#Pass
# need "" instead of ''?
# Just `pass show xxx` also works. My xxx password also has lines of other info I do not want to output
# credit: GPL-2.0-or-later https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu
# pipe to `head -n1` also works, it seems it will auto strip out \n newline char?
set imap_pass="`pass show master3 | { IFS= read -r p; printf %s \"$p\";}`"
set smtp_pass="`pass show master3 | { IFS= read -r p; printf %s \"$p\";}`"
set from='xyz@flylightning.xyz'
# /etc/neomuttrc says if use from var this will not use? not sure if works
set real_name='Xiao Pan'
# this seems also determines sidebar mailbox order
#mailboxes =INBOX =Sent =Drafts =Archive =Junk =Trash
# if fully online and use `set folder="imaps://xyz@mail.flylightning.xyz"` instead:
# default not auto subscribe to inbox? need `mailboxes =INBOX` at least
#mailboxes =INBOX
#set imap_check_subscribed
# spool_file not sure if needed
# + seems mean remote?
set spool_file='+INBOX'
set record='+Sent'
set trash='+Trash'
set postponed='+Drafts'
# `man neomuttrc.5` says "Header caching can greatly improve speed when ..."
set header_cache="$XDG_CACHE_HOME/mutt"
set message_cache_dir="$XDG_CACHE_HOME/mutt"
# Allow Mutt to open a new IMAP connection automatically.
unset imap_passive
set attach_save_dir="$XDG_DOWNLOAD_DIR"
set attach_save_without_prompting
# linux kernel mailing list rules:
set send_charset="us-ascii:utf-8"
# Sender, email address, and sign-off line must match
# because joe@localhost is just embarrassing
unset use_domain
# about pgp:
#auto_view application/pgp-encrypted
# maybe use account-hook or folder-hook to `unset crypt_auto_sign` for accounts I do not wish to auto sign
set crypt_auto_sign
set pgp_default_key='FDA389A17B94BCE0E2FA3D71842BFD347BE06812'
# maybe useful: crypt_opportunistic_encrypt, crypt-hook
# https://neomutt.org/guide/gettingstarted#2-4-%C2%A0sidebar
set sidebar_visible
set sidebar_width=20
# manpage suggested
# %<... is nested if, see https://neomutt.org/feature/nested-if
set sidebar_format='%B%<F? [%F]>%* %<N?%N/>%S'
set sidebar_short_path
# needed for some sidebar features
set mail_check_stats
# to avoid lags using IMAP with some email providers (yahoo for example)
set mail_check=60
# no ask auto save to draft
set postpone='yes'
# need echo here to run an external shell command, see https://neomutt.org/feature/global-hooks
# startup-hook works, but I'm not confidient with it because shutdown-hook is buggy, see below. Because I'll need a wrapper script for mbsync after shutdown, I decided to just use a wrapper script for mbsync before startup also for now
#startup-hook 'echo `mbsync -a`'
# I decided not to use timeout-hook and shutdown-hook hooks due to its issues with mbsync, see below
# timeout-hook and shutdown-hook configured with startup-hook will cause timeout-hook and shutdown-hook mbsync not working? see https://github.com/neomutt/neomutt/issues/3298 , my experience is shutdown-hook's mbsync not working, not sure how to test timeout-hook
# somehow `sleep 1; mbsync -a` works?
# maybe related: https://github.com/neomutt/neomutt/issues/4184 https://github.com/neomutt/neomutt/pull/4200
# more bug notes see vq
# consider I may use another email client to access remote email mailboxes, sync when shutdown so those other email client can get latest changes
#shutdown-hook 'echo `mbsync -a`'
# I don't understand timeout-hook and $timeout very well, but seems useful, $timeout default 600 seconds, so maybe it sync every 600s
#timeout-hook 'echo `mbsync -a`'
# no prompt for deleting emails
set delete=yes
# no prompt for moving emails
set confirm_append=no
# man neomuttrc, query_command: "NeoMutt will add quotes around the string
# substituted for "%s" automatically according to shell quoting rules, so you
# should avoid adding your own. If no "%s" is found in the string, NeoMutt will
# append the user's query to the end of the string."
set query_command="abook --mutt-query"
# https://neomutt.org/guide/advancedusage#8-%C2%A0external-address-queries
# completion when ask for address input
# default ^T
# another way is Q, it will let me select an address from abook and start a new email
bind editor <Tab> complete-query
# email from insp to ca mail server to others will have "Received: from xyzinsp.mynetworksettings.com" in email header, VPN only change IP but not this auto-detected hostname by neomutt, if privacy is a concern for future anonymous email server, set hostname=..., e.g.:
#set hostname='anonymous'
# maybe:
# maybe, from mutt-wizard:
# maybe add configs from mutt-wizard:
# - add Maildir configs? see arch wiki and mutt-wizard, not fully understood
# - mime type configs
# - other configs
# seems not working with this:
#set smtp_authenticators='gssapi:login'
#set forward_attachments=yes
#set forward_format = "Fwd: %s"
# can configure mailcap configs ~/.mailcap to use lynx to auto show html with lynx
#auto_view text/html
# https://blog.flaport.net/configuring-neomutt-for-email.html
# https://github.com/LukeSmithxyz/mutt-wizard/blob/master/share/mutt-wizard.muttrc
# M default to show-log-messages, can be executed by `:exec show-log-messages`
bind index,pager M noop
# C deafult to copy-message
bind index,pager C noop
# g default to group-reply
bind index,pager g noop
bind index,pager R group-reply
bind index,pager i noop
macro index,pager \'a "<change-folder>=Archive<enter>" "go to archive"
macro index,pager \'d "<change-folder>=Drafts<enter>" "go to drafts"
macro index,pager \'i "<change-folder>=INBOX<enter>" "go to inbox"
macro index,pager \'j "<change-folder>=Junk<enter>" "go to junk"
macro index,pager \'s "<change-folder>=Sent<enter>" "go to sent"
macro index,pager \'t "<change-folder>=Trash<enter>" "go to trash"
macro index,pager Ca ";<copy-message>=Archive<enter>" "copy mail to archive"
macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to drafts"
macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox"
macro index,pager Cj ";<copy-message>=Junk<enter>" "copy mail to junk"
macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent"
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash"
macro index,pager Ma ";<save-message>=Archive<enter>" "move mail to archive"
macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to drafts"
macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox"
macro index,pager Mj ";<save-message>=Junk<enter>" "move mail to junk"
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent"
macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash"
# here must specify full path of the file to source, else it will souce in the dir where neomutt is execute at
macro index,pager ia '<sync-mailbox><enter-command>source "$XDG_CONFIG_HOME/neomutt/mail"<enter><change-folder>!<enter>'
macro index,pager ib '<sync-mailbox><enter-command>source "$XDG_CONFIG_HOME/neomutt/mail2"<enter><change-folder>!<enter>'
# maybe useful for multiple accounts
#macro index c "<change-folder>?<change-dir><home>^K=<enter>"
macro index S "<shell-escape>mbsync -a<enter>" "sync email"
bind index L limit
bind attach l view-mailcap
bind pager l view-attachments
bind index l display-message
bind browser l select-entry
bind pager,attach h exit
bind index h quit
bind index g first-entry
bind index G last-entry
bind browser g top-page
bind browser G bottom-page
bind pager g top
bind pager G bottom
# N hotkey default functions change bind to E hotkey, because I want to bind N as search-opposite
bind index E toggle-new
bind pager E mark-as-new
bind browser E select-new
bind index,pager,browser N search-opposite
|