blob: da211c03029aa71a0823914f594f1a8924383503 (
plain) (
blame)
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
|
---
date: '2025-11-12T16:48:02+08:00'
draft: false
title: '使用Emacs收发邮件'
slug: 'email-with-emacs'
categories:
- 往昔
tags:
- GNU/Emacs
- Linux
---
作为一个合格的操作系统,肯定少不了Email. 我的配置很简单,只要实现基础的收发功能即可,每天的邮件量不大。在这里记录一下配置。
## 收邮件
我尝试过 **[fetchmail](https://www.fetchmail.info)**,但不知道这个东西拿到的邮件都在哪,所以最后还是选择了 **mbsync**.
```
# ~/.mbsyncrc
# GlowIsle 账户配置
IMAPAccount GlowIsle
Host imap.qiye.aliyun.com
Port 993
User i@glowisle.me
Pass ******
TLSType IMAPS
AuthMechs LOGIN
CertificateFile /etc/ssl/certs/ca-certificates.crt
# 远程存储
IMAPStore glowisle-remote
Account GlowIsle
# 本地存储
MaildirStore glowisle-local
Path ~/mail/GlowIsle/
Inbox ~/mail/GlowIsle/Inbox
Subfolders Verbatim
# 同步通道
Channel glowisle
Far :glowisle-remote:
Near :glowisle-local:
Patterns *
Create Both
Sync All
Expunge Both
SyncState *
```
## 发邮件
```
# ~/.msmtprc
# glowisle
account glowisle
host smtp.qiye.aliyun.com
from i@glowisle.me
auth login
port 465
user i@glowisle.me
password *******
auth on
tls on
tls_starttls off #使用465端口时不能开启
tls_certcheck off
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account default : glowisle
```
## Emacs 配置
在Doom Emacs的`init.el`中开启 mu4e
```lisp
:email
(mu4e +org)
```
```lisp
;; config.el
(after! mu4e
;; 基本设置
(setq mu4e-maildir "~/mail" ; 邮件目录
mu4e-get-mail-command "mbsync -a" ; 接收邮件命令
mu4e-update-interval 300 ; 自动更新间隔(秒)
mu4e-view-show-images t ; 显示图片
mu4e-compose-signature "Best regards.\nVerdant") ; 邮件签名
;; 使用 msmtp 发送邮件
(setq message-send-mail-function 'message-send-mail-with-sendmail
sendmail-program "/usr/bin/msmtp"
sendmail-arguments '("--read-envelope-from" "--read-recipients"))
(setq mu4e-contexts
(list
(make-mu4e-context
:name "GlowIsle"
:match-func (lambda (msg)
(when msg
(string-match-p "^/GlowIsle" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "i@glowisle.me")
(user-full-name . "Verdant")
(smtpmail-smtp-server . "smtp.qiye.aliyun.com")
(smtpmail-smtp-service . 465)
(smtpmail-stream-type . starttls)))))
)
```
## 基本使用
- `SPC o m` 进入 mu4e 主页面
```
Basics
* [J]ump to some maildir
* enter a [s]earch query
* [C]ompose a new message
Bookmarks
* [bu] Unread messages (0/0)
* [bt] Today's messages (0/14)
* [bw] Last 7 days
* [bp] Messages with images (0/0)
* [bf] Flagged messages (0/1)
Misc
* [;]Switch focus
* [u]pdate email & database
* [N]ews
* [A]bout mu4e
* [H]elp
* [q]uit
```
---
微软的Outlook邮箱使用OAuth2.0认证,我暂时没找到成功的解决方案能在Emacs上使用,如果有哪位路过的好哥们知道方法请留言或[发个邮件](mailto:i@glowisle.me)探讨一下!
|