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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset='utf-8'>
<title>Mutt</title>
</head>
<body>
<a href="index.html">Tools Index</a>
<h1 id="mutt">Mutt</h1>
<p>Mutt is a powerfull mail reader,
<a href="http://www.mutt.org/doc/devel/manual.html">Mutt Manual</a>,
is the best place to find information.
I recomend <a href="http://realprogrammers.com/jump_start/mutt/">Jump Start: Mutt</a>,
name says it all.</p>
<h2 id="install">1. Install</h2>
<p>Sysdoc <a href="../ports/mutt">mutt port</a> is a copy
of opt mutt port with built in SMTP and SASL. Alternative
is to use external programs like msmtp.</p>
<pre>
$ prt-get depinst mutt cyrus-sasl
</pre>
<p>Verify if mutt have SMTP support;</p>
<pre>
$ mutt -v | grep USE_SMTP
+USE_POP +USE_IMAP +USE_SMTP
</pre>
<p>Verify if mutt have SASL support;</p>
<pre>
$ mutt -v | grep USE_SASL
+USE_SSL_OPENSSL -USE_SSL_GNUTLS +USE_SASL -USE_GSS +HAVE_GETADDRINFO
</pre>
<p>Mutt will recognize follow locations for configurations
files;</p>
<dl>
<dt>/usr/etc/Muttrc</dt>
<dd>System configuration file for mutt.</dd>
<dt>~/.muttrc</dt>
<dd>User configuration file on home root.</dd>
<dt>~/.mutt/muttrc</dt>
<dd>User configuration inside home mutt folder.</dd>
</dl>
<p>Skeleton configuration will use the second user configuration
(inside home mutt folder);</p>
<pre>
$ sudo mkdir /etc/skel/.mutt
$ sudo touch /etc/skel/.mutt/mail_alias
</pre>
<p>Get gpg.rc example from distribution file;</p>
<pre>
$ tar xf /srv/ports/distfiles/mutt-1.6.1.tar.gz mutt-1.6.1/contrib/gpg.rc
$ sudo mv mutt-1.6.1/contrib/gpg.rc /etc/skel/.mutt/
</pre>
<p>If you like to use sample.muttrc distributed with
source code;</p>
<pre>
$ tar -xf /srv/ports/distfiles/mutt-1.6.1.tar.gz mutt-1.6.1/contrib/sample.muttrc
$ sudo mv mutt-1.6.1/contrib/sample.muttrc /etc/skel/.mutt/muttrc
</pre>
<pre>
$ rm -fr mutt-1.6.1/
</pre>
<h2 id="conf">2. Configure</h2>
<p>Justin R. Miller <a href="http://codesorcery.net/old/mutt/mutt-gnupg-howto">Mutt Gnupg Howto</a>
"Everything You Need To Know To Start Using GnuPG with Mutt"
is a great reference. Multiple email accounts are gracefully
handle by folder hooks, this hooks are defined in muttrc.
When we change folder the hook is called, setting up the email
account sepecific settings.<p>
<p>Lets start configuring the two accounts, one for host system
email and another for external email account. Change pgp_sign_as according to your specific sub key for signing. Change
<a href="../linux/conf/skel/.mutt/muttrc">muttrc</a> with your
preferences;</p>
<pre>
$ vim ~/.mutt/muttrc
</pre>
<pre>
set config_charset="utf-8"
# set locale="de_CH"
set charset="utf-8"
set send_charset="utf-8"
set editor="vim"
set visual=vim
set auto_tag
set sort=threads
set sort_browser=reverse-date
set sort_aux=reverse-last-date-received
set duplicate_threads=yes
set crypt_use_gpgme=yes
## automatically sign all outgoing messages
set crypt_autosign=yes
## automatically encrypt outgoing messages
set crypt_autoencrypt=yes
## automatically verify the sign of a message when opened
set crypt_verify_sig=yes
set pgp_sign_as=0x8BF422F79FC7C975BDF07828E88440BC35095A74
#set pgp_sign_as=0x8BF422F7
set pgp_timeout=1800
set pgp_autosign=yes
#set pgp_replyencrypt=yes
source ~/.mutt/gpg.rc
source "~/.mutt/mail_alias"
set alias_file=~/.mutt/mail_alias
# Header
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates
set timeout=10 # mutt 'presses' (like) a key for you
#(while you're idle) each x sec to trigger
#the thing below
set mail_check=5 # mutt checks for new mails on every keystroke
# but not more often then once in 5 seconds
set beep_new # beep on new messages in the mailboxes
## Local system account
folder-hook '.mail' 'source ~/.mutt/system'
## Remote account
folder-hook '.mailext' 'source ~/.mutt/external'
## Default account
source ~/.mutt/system
## Shortcuts
macro index,pager <f3> '<sync-mailbox><enter-command>source ~/.mutt/external<enter><change-folder>!<enter>'
macro index,pager <f2> '<sync-mailbox><enter-command>source ~/.mutt/system<enter><change-folder>!<enter>'
</pre>
<h3 id="system">2.1. System Email</h3>
<p>Check and point enviroment mail variable to new local maildir;</p>
<pre>
$ echo "MAIL=$HOME/.mail/" >> ~/.bashrc
$ source ~/.bashrc
$ env | grep MAIL
</pre>
<p>Content of <a href="../linux/conf/skel/.mutt/system">.mutt/system</a>;<p>
<pre>
color status green default
set folder="~/.mail"
set mbox_type=Maildir
set spoolfile=/var/spool/mail/machine-admin
set keep_flagged=yes
set mbox="~/.mail" # ~/.mailext/read_inbox
set postponed="+.Drafts"
set record="+.Sent"
set use_from=yes
set sendmail=/usr/sbin/exim
set ssl_starttls=no
set ssl_force_tls=no
unset pop_user
unset pop_pass
unset pop_delete
unset pop_host
unset smtp_url
set realname='machine-admin'
set from=machine-admin@localhost
</pre>
<p>Create folder;</p>
<pre>
$ mkdir -p ~/.mail/{cur,new,tmp}
</pre>
<h3 id="external">2.2. External Email</h3>
<p>Edit <a href="../linux/conf/skel/.mutt/external">.mutt/external</a>;</p>
<pre>
color status blue default
unset sendmail
set folder="~/.mailext"
set mbox_type=Maildir
set spoolfile="~/.mailext"
set keep_flagged=yes # esc-f to mark messages in spool, and
set mbox="~/.mailext"
set postponed="+.Drafts"
set record="+.Sent"
set use_from=yes
set ssl_starttls=yes
set ssl_force_tls = yes
set realname='User Name'
set from=mail@external.org
set pop_user="mail@external.org"
set pop_pass="password"
set pop_delete=yes
set pop_host="pops://$pop_user:$pop_pass@pop.external.org:995"
set smtp_url="smtps://$pop_user:$pop_pass@smtp.external.org/"
</pre>
<p>Create folder;</p>
<pre>
$ mkdir -p ~/.mailext/{cur,new,tmp}
</pre>
<h2 id="usemutt">3. Using Mutt</h2>
<p>When listing messages the status flag mean;</p>
<dl>
<dt>s</dt>
<dd>if the message is signed and not yet verified</dd>
<dt>S</dt>
<dd>if the message is signed and the signature is successfully verified</dd>
<dt>P</dt>
<dd>if the message is PGP encrypted</dd>
</dl>
<pre>
$ mutt
/home/c1admin/.mail does not exist. Create it? ([yes]/no): yes
</pre>
<p>If you get the following error;</p>
<pre>
/var/spool/mail/c1admin: No such file or directory (errno = 2)
</pre>
<p>Press q or x and lets send email to c1admin, this way we test
if alias is working and exim create mail dir for us;</p>
<pre>
$ mutt -s "test" c1admin@c13 < /dev/null
</pre>
<p>If you need to manually create a folder;</p>
<h3 id="tagmail">3.1. Tag Email</h3>
<p>Just press shift-T and then read
<a href="http://www.mutt.org/doc/manual/manual-4.html#patterns">Patterns</a>
. After matching desired messages press ; then the order, for example, d will
mark all taged for deletion.<p>
<h3 id="alias">3.2. Address alias</h3>
<p><a href="http://dev.mutt.org/trac/wiki/MuttGuide/Aliases">Alias</a>
makes easy to manage email addresses. Add this to your muttrc;</p>
<pre>
source "~/.mutt/mail_alias"
set alias_file=~/.mutt/mail_alias
</pre>
<p>While on index or page press "a" to add address to alias file.</p>
<h3 id="gpgkeys">3.3. GPG Keys</h3>
<p>Import a public key from email;</p>
<pre>
^K
</pre>
<p>^K is CTRL+K</p>
<a href="index.html">Tools Index</a>
<p>
This is part of the LeetIO System Documentation.
Copyright (C) 2021
LeetIO Team.
See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>
</body>
</html>
|