all repos — site @ b5d9a07208e0a56e2af83e212274dfd1fa4d953e

source for my site, found at icyphox.sh

S-nail post

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Wed, 06 May 2020 20:19:38 +0530
commit

b5d9a07208e0a56e2af83e212274dfd1fa4d953e

parent

4213759cbac92a74343718c3590cc882d3e53229

4 files changed, 411 insertions(+), 2 deletions(-)

jump to
M drafts/s-nail.mdpages/blog/s-nail.md

@@ -3,7 +3,7 @@ template:

url: s-nail title: The S-nail mail client subtitle: And how to achieve a usable configuration for IMAP/SMTP -date: 2020-04-30 +date: 2020-05-06 --- TL;DR: Here's my [`.mailrc`](https://github.com/icyphox/dotfiles/blob/master/home/.mailrc).

@@ -126,3 +126,57 @@

# enable account on startup account personal ``` + +You might also want to trash mail, instead of perma-deleting them +(`delete` does that). To achieve this, we define an alias: + +``` +define trash { + move "$@" +Trash +} + +commandalias del call trash +``` + +Replace `+Trash` with the relative path to your trash folder. + + +## aesthetics + +The fun stuff. I don't feel like explaining what these do (hint: I don't +fully understand it either), so just copy-paste it and mess around with +the colors: + +``` +# use whatever symbol you fancy +set prompt='> ' + +colour 256 sum-dotmark ft=bold,fg=13 dot +colour 256 sum-header fg=007 older +colour 256 sum-header bg=008 dot +colour 256 sum-header fg=white +colour 256 sum-thread bg=008 dot +colour 256 sum-thread fg=cyan +``` + +The prompt can be configured more extensively, but I don't need it. Read +the man page if you do. + +## essential commands + +Eh, you can just read the man page, I guess. But here's a quick list off +the top of my head: + +- `headers`: Lists all messages, with the date, subject etc. +- `mail`: Compose mail. +- `<number>`: Read mail by specifiying its number on the message list. +- `delete <number>`: Delete mail. +- `new <number>`: Mark as new (unread). +- `file <shortcut or path to folder>`: Change folders. For example: `file + sent` + +That's all there is to it. + +*This is day 2 of the #100DaysToOffload challenge. I didn't think I'd +participate, until today. So yesterday's post is day 1. Will I keep at +it? I dunno. We'll see.*
M pages/_index.mdpages/_index.md

@@ -9,6 +9,7 @@ ## Computers, security & computer security.

| | | | :-- | --: | +| [The S-nail mail client](/blog/s-nail) | 2020-05-06 | | [Stop joining mastodon.social](/blog/mastodon-social) | 2020-05-05 | | [OpenBSD on the HP Envy 13](/blog/openbsd-hp-envy) | 2020-04-17 | | [The Zen of KISS Linux](/blog/kiss-zen) | 2020-04-03 |
M pages/blog/feed.xmlpages/blog/feed.xml

@@ -11,7 +11,182 @@ <link>https://icyphox.sh/blog/</link>

</image> <language>en-us</language> <copyright>Creative Commons BY-NC-SA 4.0</copyright> - <item><title>Stop joining mastodon.social</title><description><![CDATA[<p>No, really. Do you actually understand why the Mastodon network exists, + <item><title>The S-nail mail client</title><description><![CDATA[<p>TL;DR: Here&#8217;s my <a href="https://github.com/icyphox/dotfiles/blob/master/home/.mailrc"><code>.mailrc</code></a>.</p> + +<p>As I&#8217;d mentioned in my blog post about <a href="/blog/mael">mael</a>, I&#8217;ve been on +the lookout for a good, usable mail client. As it happens, I found +S-nail just as I was about to give up on mael. Turns out writing an MUA +isn&#8217;t all too easy after all. S-nail turned out to be the perfect client +for me, but I had to invest quite some time in reading the <a href="https://www.sdaoden.eu/code-nail.html">very +thorough manual</a> and exchanging +emails with its <a href="https://www.sdaoden.eu">very friendly author</a>. I did it +so you don&#8217;t have to<sup class="footnote-ref" id="fnref-read-man"><a href="#fn-read-man">1</a></sup>, and I present to you +this guide.</p> + +<h2 id="basic-settings">basic settings</h2> + +<p>These settings below should guarantee some sane defaults to get started +with. Comments added for context.</p> + +<pre><code># enable upward compatibility with S-nail v15.0 +set v15-compat + +# charsets we send mail in +set sendcharsets=utf-8,iso-8859-1 + +# reply back in sender's charset +set reply-in-same-charset + +# prevent stripping of full names in replies +set fullnames + +# adds a 'Mail-Followup-To' header; useful in mailing lists +set followup-to followup-to-honour-ask-yes + +# asks for an attachment after composing +set askattach + +# marks a replied message as answered +set markanswered + +# honors the 'Reply-To' header +set reply-to-honour + +# automatically launches the editor while composing mail interactively +set editalong + +# I didn't fully understand this :) +set history-gabby=all + +# command history storage +set history-file=~/.s-nailhist + +# sort mail by date (try 'thread' for threaded view) +set autosort=date +</code></pre> + +<h2 id="authentication">authentication</h2> + +<p>With these out of the way, we can move on to configuring our +account&#8212;authenticating IMAP and SMTP. Before that, however, we&#8217;ll +have to create a <code>~/.netrc</code> file to store our account credentials. </p> + +<p>(This of course, assumes that your SMTP and IMAP credentials are the +same. I don&#8217;t know what to do otherwise. )</p> + +<pre><code>machine *.domain.tld login user@domain.tld password hunter2 +</code></pre> + +<p>Once done, encrypt this file using <code>gpg</code> / <code>gpg2</code>. This is optional, but +recommended.</p> + +<pre><code>$ gpg2 --symmetric --cipher-algo AES256 -o .netrc.gpg .netrc +</code></pre> + +<p>You can now delete the plaintext <code>.netrc</code> file. Now add these lines to +your <code>.mailrc</code>:</p> + +<pre><code>set netrc-lookup +set netrc-pipe='gpg2 -qd ~/.netrc.gpg' +</code></pre> + +<p>Before we define our account block, add these two lines for a nicer IMAP +experience:</p> + +<pre><code>set imap-cache=~/.cache/nail +set imap-keepalive=240 +</code></pre> + +<p>Defining an account is dead simple. </p> + +<pre><code>account "personal" { + localopts yes + set from="Your Name &lt;user@domain.tld&gt;" + set folder=imaps://imap.domain.tld:993 + + # copy sent messages to Sent; '+' indicates subdir of 'folder' + set record=+Sent + set inbox=+INBOX + + # optionally, set this to 'smtps' and change the port accordingly + # remove 'smtp-use-starttls' + set mta=smtp://smtp.domain.tld:587 smtp-use-starttls + + # couple of shortcuts to useful folders + shortcut sent +Sent \ + inbox +INBOX \ + drafts +Drafts \ + trash +Trash \ + archives +Archives +} + +# enable account on startup +account personal +</code></pre> + +<p>You might also want to trash mail, instead of perma-deleting them +(<code>delete</code> does that). To achieve this, we define an alias:</p> + +<pre><code>define trash { + move "$@" +Trash +} + +commandalias del call trash +</code></pre> + +<p>Replace <code>+Trash</code> with the relative path to your trash folder.</p> + +<h2 id="aesthetics">aesthetics</h2> + +<p>The fun stuff. I don&#8217;t feel like explaining what these do (hint: I don&#8217;t +fully understand it either), so just copy-paste it and mess around with +the colors:</p> + +<pre><code># use whatever symbol you fancy +set prompt='&gt; ' + +colour 256 sum-dotmark ft=bold,fg=13 dot +colour 256 sum-header fg=007 older +colour 256 sum-header bg=008 dot +colour 256 sum-header fg=white +colour 256 sum-thread bg=008 dot +colour 256 sum-thread fg=cyan +</code></pre> + +<p>The prompt can be configured more extensively, but I don&#8217;t need it. Read +the man page if you do.</p> + +<h2 id="essential-commands">essential commands</h2> + +<p>Eh, you can just read the man page, I guess. But here&#8217;s a quick list off +the top of my head:</p> + +<ul> +<li><code>headers</code>: Lists all messages, with the date, subject etc.</li> +<li><code>mail</code>: Compose mail.</li> +<li><code>&lt;number&gt;</code>: Read mail by specifiying its number on the message list.</li> +<li><code>delete &lt;number&gt;</code>: Delete mail.</li> +<li><code>new &lt;number&gt;</code>: Mark as new (unread).</li> +<li><code>file &lt;shortcut or path to folder&gt;</code>: Change folders. For example: <code>file +sent</code></li> +</ul> + +<p>That&#8217;s all there is to it.</p> + +<p><em>This is day 2 of the #100DaysToOffload challenge. I didn&#8217;t think I&#8217;d +participate, until today. So yesterday&#8217;s post is day 1. Will I keep at +it? I dunno. We&#8217;ll see.</em></p> + +<div class="footnotes"> +<hr /> +<ol> +<li id="fn-read-man"> +<p>Honestly, read the man page (and email Steffen!)&#8212;there&#8217;s +a ton of useful options in there.&#160;<a href="#fnref-read-man" class="footnoteBackLink" title="Jump back to footnote 1 in the text.">&#8617;</a></p> +</li> +</ol> +</div> +]]></description><link>https://icyphox.sh/blog/s-nail</link><pubDate>Wed, 06 May 2020 00:00:00 +0000</pubDate><guid>https://icyphox.sh/blog/s-nail</guid></item><item><title>Stop joining mastodon.social</title><description><![CDATA[<p>No, really. Do you actually understand why the Mastodon network exists, and what it stands for, or are you just LARPing? If you&#8217;re going to just cross-post from Twitter, why are you even on Mastodon?</p>
A pages/txt/s-nail.txt

@@ -0,0 +1,179 @@

+--- +date: '2020-05-06' +subtitle: And how to achieve a usable configuration for IMAP/SMTP +title: 'The S-nail mail client' +url: 's-nail' +--- + +TL;DR: Here's my +[`.mailrc`](https://github.com/icyphox/dotfiles/blob/master/home/.mailrc). + +As I'd mentioned in my blog post about [mael](/blog/mael), I've been on +the lookout for a good, usable mail client. As it happens, I found +S-nail just as I was about to give up on mael. Turns out writing an MUA +isn't all too easy after all. S-nail turned out to be the perfect client +for me, but I had to invest quite some time in reading the [very +thorough manual](https://www.sdaoden.eu/code-nail.html) and exchanging +emails with its [very friendly author](https://www.sdaoden.eu). I did it +so you don't have to[^1], and I present to you this guide. + +basic settings +-------------- + +These settings below should guarantee some sane defaults to get started +with. Comments added for context. + +``` {.conf} +# enable upward compatibility with S-nail v15.0 +set v15-compat + +# charsets we send mail in +set sendcharsets=utf-8,iso-8859-1 + +# reply back in sender's charset +set reply-in-same-charset + +# prevent stripping of full names in replies +set fullnames + +# adds a 'Mail-Followup-To' header; useful in mailing lists +set followup-to followup-to-honour-ask-yes + +# asks for an attachment after composing +set askattach + +# marks a replied message as answered +set markanswered + +# honors the 'Reply-To' header +set reply-to-honour + +# automatically launches the editor while composing mail interactively +set editalong + +# I didn't fully understand this :) +set history-gabby=all + +# command history storage +set history-file=~/.s-nailhist + +# sort mail by date (try 'thread' for threaded view) +set autosort=date +``` + +authentication +-------------- + +With these out of the way, we can move on to configuring our +account---authenticating IMAP and SMTP. Before that, however, we'll have +to create a `~/.netrc` file to store our account credentials. + +(This of course, assumes that your SMTP and IMAP credentials are the +same. I don't know what to do otherwise. ) + +``` {.netrc} +machine *.domain.tld login user@domain.tld password hunter2 +``` + +Once done, encrypt this file using `gpg` / `gpg2`. This is optional, but +recommended. + + $ gpg2 --symmetric --cipher-algo AES256 -o .netrc.gpg .netrc + +You can now delete the plaintext `.netrc` file. Now add these lines to +your `.mailrc`: + +``` {.conf} +set netrc-lookup +set netrc-pipe='gpg2 -qd ~/.netrc.gpg' +``` + +Before we define our account block, add these two lines for a nicer IMAP +experience: + +``` {.conf} +set imap-cache=~/.cache/nail +set imap-keepalive=240 +``` + +Defining an account is dead simple. + +``` {.conf} +account "personal" { + localopts yes + set from="Your Name <user@domain.tld>" + set folder=imaps://imap.domain.tld:993 + + # copy sent messages to Sent; '+' indicates subdir of 'folder' + set record=+Sent + set inbox=+INBOX + + # optionally, set this to 'smtps' and change the port accordingly + # remove 'smtp-use-starttls' + set mta=smtp://smtp.domain.tld:587 smtp-use-starttls + + # couple of shortcuts to useful folders + shortcut sent +Sent \ + inbox +INBOX \ + drafts +Drafts \ + trash +Trash \ + archives +Archives +} + +# enable account on startup +account personal +``` + +You might also want to trash mail, instead of perma-deleting them +(`delete` does that). To achieve this, we define an alias: + + define trash { + move "$@" +Trash + } + + commandalias del call trash + +Replace `+Trash` with the relative path to your trash folder. + +aesthetics +---------- + +The fun stuff. I don't feel like explaining what these do (hint: I don't +fully understand it either), so just copy-paste it and mess around with +the colors: + + # use whatever symbol you fancy + set prompt='> ' + + colour 256 sum-dotmark ft=bold,fg=13 dot + colour 256 sum-header fg=007 older + colour 256 sum-header bg=008 dot + colour 256 sum-header fg=white + colour 256 sum-thread bg=008 dot + colour 256 sum-thread fg=cyan + +The prompt can be configured more extensively, but I don't need it. Read +the man page if you do. + +essential commands +------------------ + +Eh, you can just read the man page, I guess. But here's a quick list off +the top of my head: + +- `headers`: Lists all messages, with the date, subject etc. +- `mail`: Compose mail. +- `<number>`: Read mail by specifiying its number on the message list. +- `delete <number>`: Delete mail. +- `new <number>`: Mark as new (unread). +- `file <shortcut or path to folder>`: Change folders. For example: + `file sent` + +That's all there is to it. + +*This is day 2 of the \#100DaysToOffload challenge. I didn't think I'd +participate, until today. So yesterday's post is day 1. Will I keep at +it? I dunno. We'll see.* + +[^1]: Honestly, read the man page (and email Steffen!)---there's a ton + of useful options in there.