blob: 7edac422d3bbb39fa0958e793380ba2d5e285e1b (
plain) (
tree)
|
|
<!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="conf/etc/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="conf/etc/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="conf/etc/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 Tribu System Documentation.
Copyright (C) 2020
Tribu Team.
See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>
</body>
</html>
|