all repos — site @ f66c2c121ae3edd04ec3b8ca9b960cd9f632d8aa

source for my site, found at icyphox.sh

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

 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
   06 May, 2020

The S-nail mail client

And how to achieve a usable configuration for IMAP/SMTP

   TL;DR: Here's my [1].mailrc.

   As I'd mentioned in my blog post about [2]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 [3]very thorough
   manual and exchanging emails with its [4]very friendly author. I did it
   so you don't have to^[5]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.
# 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. )
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:
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:
set imap-cache=~/.cache/nail
set imap-keepalive=240

   Defining an account is dead simple.
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.

References

   1. https://github.com/icyphox/dotfiles/blob/master/home/.mailrc
   2. https://icyphox.sh/blog/mael
   3. https://www.sdaoden.eu/code-nail.html
   4. https://www.sdaoden.eu/
   5. https://icyphox.sh/home/icy/leet/site/build/blog/s-nail/temp.html#fn:read-man