git send-email + gmail使用

git send-email

sudo apt install git-email

配置 git

.git/config

参照https://gist.github.com/jasonkarns/4354421:

1
2
3
4
5
6
7
[sendemail]
confirm = auto
smtpServer = smtp.gmail.com
smtpServerPort = 587
smtpEncryption = tls
smtpUser = <gmail email address>
smtpPass = <app-specific-password>

设置应用密码(要开启两步验证

https://security.google.com/settings/security/apppasswords

1
Google Account -> Security -> Signing in to Google : App passwords

设置完之后就可以用git send-email发送邮件了

使用 mutt

sudo apt-get install mutt

参照https://ouonline.net/mutt-notes:

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
# ~/.muttrc

# ================ IMAP ====================

set imap_user = "<your-mail-name>@gmail.com"
set imap_pass = '<your-app-password>'

# ================ SMTP ====================

set smtp_url = "smtp://<your-mail-name>@smtp.gmail.com:587/"
set smtp_pass = '<your-app-password>'
set ssl_force_tls = yes # Require encrypted connection

# ================ GMail =====================

set folder = "imaps://imap.gmail.com/"
# 根据 mutt 中邮箱列表是中文还是英文来配置
set spoolfile = "+INBOX" # 或者 "+[Gmail]/所有邮件"
set record = "+[Gmail]/已发邮件"
set postponed = "+[Gmail]/草稿"
set mbox = "+[Gmail]/所有邮件"
set trash = "+[Gmail]/已删除邮件"

# ================ Composition ====================

set editor = emacs
set edit_headers = yes # See the headers when editing
set charset = UTF-8 # value of $LANG; also fallback for send_charset
set include # 回复时包含原文
# Sender, email address, and sign-off line must match
unset use_domain # because joe@localhost is just embarrassing
set realname = "<your-real-name>"
set from = "<your-mail-name>@gmail.com"
set use_from = yes

配置好通过mutt命令看发邮件。