03-email-account: add himalaya setup and send/receive verification -- 小糯
This commit is contained in:
parent
65b7923947
commit
4d14155885
@ -6,7 +6,7 @@
|
||||
cfg get MY_EMAIL
|
||||
```
|
||||
|
||||
✅ 达标:返回 `你的名字@shazhou.work`,且该邮箱在 mcmail 账号列表中存在
|
||||
✅ 达标:返回 `你的名字@shazhou.work`,且能收发邮件
|
||||
|
||||
## 前置
|
||||
|
||||
@ -34,9 +34,9 @@ printf '%s\n%s\n' "$MAILCHEAP_USERNAME" "$MAILCHEAP_PASSWORD" | mcmail login
|
||||
mcmail accounts list
|
||||
```
|
||||
|
||||
如果列表中已有你的 `xxx@shazhou.work` 账号,跳到第 5 步。
|
||||
如果列表中已有你的 `xxx@shazhou.work` 账号且你知道密码,跳到第 5 步。
|
||||
|
||||
### 4. 创建邮箱(如果不存在)
|
||||
### 4. 创建/重建邮箱
|
||||
|
||||
邮箱名用你的身份名,如 `xiaonuo`、`xingyue`:
|
||||
|
||||
@ -44,22 +44,72 @@ mcmail accounts list
|
||||
mcmail accounts create 你的名字@shazhou.work --password "你的邮箱密码"
|
||||
```
|
||||
|
||||
如果忘了密码,可以用管理员身份删掉重建:
|
||||
|
||||
```bash
|
||||
echo "y" | mcmail accounts delete 你的名字@shazhou.work
|
||||
mcmail accounts create 你的名字@shazhou.work --password "新密码"
|
||||
```
|
||||
|
||||
### 5. 存入 cfg personal scope
|
||||
|
||||
```bash
|
||||
cfg set MY_EMAIL 你的名字@shazhou.work
|
||||
cfg set MY_EMAIL_PASSWORD '你的邮箱密码' --secret
|
||||
```
|
||||
|
||||
后续 git identity、通知等配置都从这里读取。
|
||||
### 6. 配置 himalaya(邮件 CLI)
|
||||
|
||||
安装 himalaya:
|
||||
|
||||
```bash
|
||||
curl -sSL https://raw.githubusercontent.com/pimalaya/himalaya/master/install.sh | PREFIX=~/.local sh
|
||||
```
|
||||
|
||||
创建 `~/.config/himalaya/config.toml`:
|
||||
|
||||
```toml
|
||||
[accounts.shazhou]
|
||||
email = "你的名字@shazhou.work"
|
||||
display-name = "你的显示名"
|
||||
default = true
|
||||
|
||||
backend.type = "imap"
|
||||
backend.host = "mail8.mymailcheap.com"
|
||||
backend.port = 993
|
||||
backend.encryption.type = "tls"
|
||||
backend.login = "你的名字@shazhou.work"
|
||||
backend.auth.type = "password"
|
||||
backend.auth.cmd = "cfg get MY_EMAIL_PASSWORD"
|
||||
|
||||
message.send.backend.type = "smtp"
|
||||
message.send.backend.host = "mail8.mymailcheap.com"
|
||||
message.send.backend.port = 465
|
||||
message.send.backend.encryption.type = "tls"
|
||||
message.send.backend.login = "你的名字@shazhou.work"
|
||||
message.send.backend.auth.type = "password"
|
||||
message.send.backend.auth.cmd = "cfg get MY_EMAIL_PASSWORD"
|
||||
```
|
||||
|
||||
密码通过 `cfg get MY_EMAIL_PASSWORD` 动态获取,不硬编码在配置里。
|
||||
|
||||
## 验证
|
||||
|
||||
确认邮箱可用:
|
||||
给自己发一封邮件,确认能收到:
|
||||
|
||||
```bash
|
||||
# 账号存在
|
||||
mcmail accounts info $(cfg get MY_EMAIL)
|
||||
cat << EOF | himalaya message send
|
||||
From: $(cfg get MY_EMAIL)
|
||||
To: $(cfg get MY_EMAIL)
|
||||
Subject: Onboard email test
|
||||
|
||||
# cfg 能读到
|
||||
cfg get MY_EMAIL
|
||||
Hello from $(hostname)!
|
||||
EOF
|
||||
|
||||
# 等几秒后检查收件箱(可能在 Junk 里)
|
||||
sleep 10
|
||||
himalaya envelope list
|
||||
himalaya envelope list --folder Junk
|
||||
```
|
||||
|
||||
✅ 达标:Sent 里有发出的邮件,INBOX 或 Junk 里收到了邮件。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user