blog-site

git clone git://git.lin.moe/blog-site.git

 1---
 2title: "Neomutt 配置(完全版)"
 3date: 2022-05-29T08:02:27+08:00
 4draft: true
 5---
 6
 7之前写过一篇简要的 [Neomutt 的使用](https://lin.moe/tutorial/2022/02/neomutt_smtp/), 之后笔者的工具和配置发生了一些变化,遂写下此文作为记录。  
 8
 9本文只考虑单用户模式,其他帐号的邮件均转发至主邮箱阅读。  
10  
11涉及软件包括  
12* Neomutt
13* offlineimap  
14* notmuch  
15* msmtp  
16* gnupg
17
18笔者最新的 dotfiles 可以在 [sourcehut](https://git.sr.ht/~lindsay/dotfiles) 找到。  
19
20## offlineimap  
21首先需要配置 imap 同步软件,将 imap 文件夹同步到本地,这里选用 offlineimap。  
22替代方案有 mbsync。  
23
24offlineimap 的基础配置为四部分,包括 通用配置、帐号配置、远程文件、本地文件。  
25
26```
27[general]
28  accounts = i-linmoe
29  pythonfile = ~/.config/offlineimap/offlineimap.py
30  maxsyncaccounts = 2
31
32[Account i-linmoe]
33  autorefresh = 0.5
34  quick = 5
35  localrepository = i-linmoe-local
36  remoterepository = i-linmoe-remote
37  postsynchook = ~/.config/offlineimap/notmuch-hook.sh
38
39[Repository i-linmoe-local]
40  type = Maildir
41  localfolders = ~/.mail/i-linmoe
42
43[Repository i-linmoe-remote]
44  type = IMAP
45  remotehost = imap.lin.moe
46  remoteuser = i@lin.moe
47  keepalive = 60
48  holdconnectionopen = yes
49  remotepasseval = get_pass("i@lin.moe")
50  #folderfilter = lambda foldername: foldername in ["INBOX", "Sent"]
51  sslcacertfile = /etc/ssl/certs/ca-certificates.crt
52  ssl_version = tls1_2
53```