SF

Stanisław (Stan) Findeisen

Software Engineer/Architect

I transform complex requirements into elegant software architectures.

The ultimate email client setup using mbsync(1) and neomutt(1)

Summary

Minimalistic email client setup using IMAP, mbsync and NeoMutt. Features include: small attack surface, small CPU and memory footprint, convenient command-line interface, POP3-like experience with IMAP syncs, PGP-encrypted passwords, 1:1 correspondence between email messages and files (Maildir). This can be used as your primary email client solution or as a backup.

1. mbsync(1) configuration

~/.mbsyncrc
 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
################################################################
# Global defaults
################################################################

Create           Both
Remove           None
Expunge          Both
Sync             All
SyncState        *
CopyArrivalDate  yes
MaxMessages      0

################################################################
# infomaniak
################################################################

IMAPStore           infomaniak-remote
Host                mail.infomaniak.com
Port                143
User                stanislaw@ik.me
PassCmd             "/usr/bin/gpg --batch -dq ~/my-pwd/infomaniak.txt.asc"
SSLType             STARTTLS
SSLVersions         SSLv3 TLSv1.2
SystemCertificates  yes
Timeout             15

MaildirStore  infomaniak-local
Path          ~/my-mail/infomaniak/
Inbox         ~/my-mail/infomaniak/INBOX
SubFolders    Verbatim

Channel    infomaniak
Master     :infomaniak-remote:
Slave      :infomaniak-local:
Patterns   *

2. neomutt(1) configuration

~/.neomutt/neomuttrc
 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
source sidebar.rc
source color.rc
source hook.rc
source key-bind.rc
source crypt.rc
source pgp.rc

# show HTML content directly
auto_view text/html

set alias_file                     = alias.rc
source $alias_file

set edit_headers                   = yes
set editor                         = vim
set empty_subject                  = "Re: "
set encode_from                    = yes
set imap_check_subscribed          = yes
set imap_keepalive                 = 120    # in seconds
set mail_check                     = 120    # in seconds
set mbox_type                      = Maildir
set mime_forward                   = no     # yes => Bcc headers will be forwarded too
set sort                           = reverse-date
set ssl_force_tls                  = yes
set ssl_starttls                   = yes

The above settings are just to give you an idea. There are many more that you might want to tweak.

~/.neomutt/infomaniak.rc
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
source neomuttrc

set folder     = "~/my-mail/infomaniak/"
set smtp_url   = "smtp://stanislaw@ik.me@mail.infomaniak.com:587"
set smtp_pass  = "`/usr/bin/gpg --batch -dq ~/my-pwd/infomaniak.txt.asc`"

set from       = "stanislaw@ik.me"
set realname   = "Stanisław Findeisen"

set spoolfile  = "+INBOX"
set record     = "+Sent"
set trash      = "+Trash"
set postponed  = "+Drafts"

mailboxes =INBOX =Archives =Drafts =Sent =Spam =Trash

3. Running

1
2
mbsync infomaniak
neomutt -F infomaniak.rc

That's it! Your mail will appear in ~/my-mail/infomaniak/.