<p>
This article describes an old-school email client setup.
</p>
<p>
Why is an email solution from the 1990s still useful in the 2020s?
</p>
<ul>
<li>Emails are downloaded and saved locally.</li>
<li>The standardized file format for emails can be read by nearly all email clients.</li>
<li>Making local backups of emails is easily possible.</li>
<li>Downloading emails solves "out of space" issues with email account providers.</li>
</ul>

<h3>Contents</h3>
<ul>
<li><a href="#procmail">Procmail</a></li>
<li><a href="#fetchmail">Fetchmail</a></li>
<li><a href="#mutt">Mutt</a>
<li><a href="#links">External Links</a></li>
</ul>

<h3 id="procmail">Procmail</h3>
<p>
Procmail is a simple mail delivery agent (MDA).<br />
If a given regular expression is matched,<br />
the mail is delivered into the specified mailbox.
</p>
<p>
Installation:
</p>
<pre><code class="language-bash">sudo apt install procmail
</code></pre>
<p>
Specify the local mail directories:
</p>
<dl class="file">
<dt><code class="filename">$HOME/.procmailrc</code></dt>
<dd>
<pre class="file"><code class="language-plaintext">MAILDIR=$HOME/Mail
DEFAULT=$MAILDIR/default/
LOGFILE=$MAILDIR/procmail.log

:0
* ^TO_johndoe@gmx\.net
johndoe@gmx.net/

:0
* ^From.*johndoe@gmx\.net
johndoe@gmx.net/.Sent/
</code></pre>
</dd>
</dl>
<p>
Ensure the directories exist:
</p>
<pre><code class="language-bash">mkdir -p $HOME/Mail/default
mkdir -p $HOME/Mail/johndoe@gmx.net
</code></pre>

<h3 id="fetchmail">Fetchmail</h3>
<p>
Fetchmail is a mail retrieval agent (MRA).
</p>
<p>
Installation:
</p>
<pre><code class="language-bash">sudo apt install fetchmail
</code></pre>
<p>
Configure the email account:
</p>
<dl class="file">
<dt><code class="filename">$HOME/.fetchmailrc</code></dt>
<dd>
<pre class="file"><code class="language-plaintext">poll imap.gmx.net
    protocol imap
    username "johndoe@gmx.net"
    password "secretpassword"
    ssl
    folders INBOX,Sent,Gesendet
    keep
    mda "/usr/bin/procmail -d %T"
</code></pre>
</dd>
</dl>
<p>
Because the file contains passwords,<br />
ensure that only the file owner can read it:
</p>
<pre><code class="language-bash">chmod 0600 $HOME/.fetchmailrc</code></pre>
<p>
Download new emails:
</p>
<pre><code class="language-bash">fetchmail</code></pre>
<p>
Download all emails:<br />
(might create duplicates)
</p>
<pre><code class="language-bash">fetchmail --all</code></pre>

<h3 id="mutt">Mutt</h3>
<p>
Mutt is a terminal-based mail user agent (MUA), an email client.
</p>
<p>
Installation:
</p>
<pre><code class="language-bash">sudo apt install mutt
</code></pre>
<p>
View and search downloaded emails:
</p>
<pre><code class="language-bash">mutt -f $HOME/Mail/johndoe@gmx.net/</code></pre>

<h3 id="links">External Links</h3>
<ul>
<li><a href="https://www.fetchmail.info/" target="_blank">
https://www.fetchmail.info/</a></li>
<li><a href="http://www.mutt.org/" target="_blank">
http://www.mutt.org/</a></li>
<li><a href="https://www.rfc-editor.org/rfc/rfc2822" target="_blank">
https://www.rfc-editor.org/rfc/rfc2822</a></li>
</ul>