From 4d14155885dd82dc6af4bcedc7f7716eb4a42e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=B3=AF=20=28Xiaonuo=29?= Date: Wed, 22 Apr 2026 23:10:40 +0800 Subject: [PATCH] =?UTF-8?q?03-email-account:=20add=20himalaya=20setup=20an?= =?UTF-8?q?d=20send/receive=20verification=20--=20=E5=B0=8F=E7=B3=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../references/03-email-account.md | 68 ++++++++++++++++--- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/hermes/shazhou-family-onboard/references/03-email-account.md b/hermes/shazhou-family-onboard/references/03-email-account.md index 2cfc8ad..4e3b4bc 100644 --- a/hermes/shazhou-family-onboard/references/03-email-account.md +++ b/hermes/shazhou-family-onboard/references/03-email-account.md @@ -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 里收到了邮件。