all repos — site @ 2e62d976dc907a96e45f0f644e3f8f9fd3299b02

source for my site, found at icyphox.sh

pages/txt/s-nail.txt (view raw)

  1   06 May, 2020
  2
  3The S-nail mail client
  4
  5And how to achieve a usable configuration for IMAP/SMTP
  6
  7   TL;DR: Here's my [1].mailrc.
  8
  9   As I'd mentioned in my blog post about [2]mael, I've been on the
 10   lookout for a good, usable mail client. As it happens, I found S-nail
 11   just as I was about to give up on mael. Turns out writing an MUA isn't
 12   all too easy after all. S-nail turned out to be the perfect client for
 13   me, but I had to invest quite some time in reading the [3]very thorough
 14   manual and exchanging emails with its [4]very friendly author. I did it
 15   so you don't have to^[5]1, and I present to you this guide.
 16
 17basic settings
 18
 19   These settings below should guarantee some sane defaults to get started
 20   with. Comments added for context.
 21# enable upward compatibility with S-nail v15.0
 22set v15-compat
 23
 24# charsets we send mail in
 25set sendcharsets=utf-8,iso-8859-1
 26
 27# reply back in sender's charset
 28set reply-in-same-charset
 29
 30# prevent stripping of full names in replies
 31set fullnames
 32
 33# adds a 'Mail-Followup-To' header; useful in mailing lists
 34set followup-to followup-to-honour-ask-yes
 35
 36# asks for an attachment after composing
 37set askattach
 38
 39# marks a replied message as answered
 40set markanswered
 41
 42# honors the 'Reply-To' header
 43set reply-to-honour
 44
 45# automatically launches the editor while composing mail interactively
 46set editalong
 47
 48# I didn't fully understand this :)
 49set history-gabby=all
 50
 51# command history storage
 52set history-file=~/.s-nailhist
 53
 54# sort mail by date (try 'thread' for threaded view)
 55set autosort=date
 56
 57authentication
 58
 59   With these out of the way, we can move on to configuring our account --
 60   authenticating IMAP and SMTP. Before that, however, we'll have to
 61   create a ~/.netrc file to store our account credentials.
 62
 63   (This of course, assumes that your SMTP and IMAP credentials are the
 64   same. I don't know what to do otherwise. )
 65machine *.domain.tld login user@domain.tld password hunter2
 66
 67   Once done, encrypt this file using gpg / gpg2. This is optional, but
 68   recommended.
 69$ gpg2 --symmetric --cipher-algo AES256 -o .netrc.gpg .netrc
 70
 71   You can now delete the plaintext .netrc file. Now add these lines to
 72   your .mailrc:
 73set netrc-lookup
 74set netrc-pipe='gpg2 -qd ~/.netrc.gpg'
 75
 76   Before we define our account block, add these two lines for a nicer
 77   IMAP experience:
 78set imap-cache=~/.cache/nail
 79set imap-keepalive=240
 80
 81   Defining an account is dead simple.
 82account "personal" {
 83    localopts yes
 84    set from="Your Name <user@domain.tld>"
 85    set folder=imaps://imap.domain.tld:993
 86
 87    # copy sent messages to Sent; '+' indicates subdir of 'folder'
 88    set record=+Sent
 89    set inbox=+INBOX
 90
 91    # optionally, set this to 'smtps' and change the port accordingly
 92    # remove 'smtp-use-starttls'
 93    set mta=smtp://smtp.domain.tld:587 smtp-use-starttls
 94
 95    # couple of shortcuts to useful folders
 96    shortcut sent +Sent \
 97        inbox +INBOX \
 98        drafts +Drafts \
 99        trash +Trash \
100        archives +Archives
101}
102
103# enable account on startup
104account personal
105
106   You might also want to trash mail, instead of perma-deleting them
107   (delete does that). To achieve this, we define an alias:
108define trash {
109    move "$@" +Trash
110}
111
112commandalias del call trash
113
114   Replace +Trash with the relative path to your trash folder.
115
116aesthetics
117
118   The fun stuff. I don't feel like explaining what these do (hint: I
119   don't fully understand it either), so just copy-paste it and mess
120   around with the colors:
121# use whatever symbol you fancy
122set prompt='> '
123
124colour 256 sum-dotmark ft=bold,fg=13 dot
125colour 256 sum-header fg=007 older
126colour 256 sum-header bg=008 dot
127colour 256 sum-header fg=white
128colour 256 sum-thread bg=008 dot
129colour 256 sum-thread fg=cyan
130
131   The prompt can be configured more extensively, but I don't need it.
132   Read the man page if you do.
133
134essential commands
135
136   Eh, you can just read the man page, I guess. But here's a quick list
137   off the top of my head:
138     * headers: Lists all messages, with the date, subject etc.
139     * mail: Compose mail.
140     * <number>: Read mail by specifiying its number on the message list.
141     * delete <number>: Delete mail.
142     * new <number>: Mark as new (unread).
143     * file <shortcut or path to folder>: Change folders. For example:
144       file sent
145
146   That's all there is to it.
147
148   This is day 2 of the #100DaysToOffload challenge. I didn't think I'd
149   participate, until today. So yesterday's post is day 1. Will I keep at
150   it? I dunno. We'll see.
151     __________________________________________________________________
152
153    1. Honestly, read the man page (and email Steffen!) -- there's a ton
154       of useful options in there.
155
156References
157
158   1. https://github.com/icyphox/dotfiles/blob/master/home/.mailrc
159   2. https://icyphox.sh/blog/mael
160   3. https://www.sdaoden.eu/code-nail.html
161   4. https://www.sdaoden.eu/
162   5. https://icyphox.sh/home/icy/leet/site/build/blog/s-nail/temp.html#fn:read-man