email-notify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Email Notify

邮件通知

Overview

概述

Send an email notification after each Codex task. Use the helper script to resolve the project name and send via SMTP.
在每个Codex任务完成后发送邮件通知。使用辅助脚本解析项目名称并通过SMTP发送邮件。

User Preparation

用户准备

1) Configure environment variables

1) 配置环境变量

Add the following lines to
~/.bashrc
(Linux) or
~/.zshrc
(macOS):
export CODEX_MACHINE_NAME="Machine-name" # e.g., Macbook
export CODEX_EMAIL_SMTP_HOST="smtp.example.com"
export CODEX_EMAIL_SMTP_PORT="587"
export CODEX_EMAIL_USERNAME="user@example.com"
export CODEX_EMAIL_PASSWORD="..."
export CODEX_EMAIL_FROM="user@example.com"
export CODEX_EMAIL_TO="recipient1@example.com,recipient2@example.com"
export CODEX_EMAIL_USE_TLS="false" # true/false, default false
export CODEX_EMAIL_USE_SSL="true" # true/false, default true
If your SMTP server does not require auth, leave
CODEX_EMAIL_USERNAME
and
CODEX_EMAIL_PASSWORD
unset. Set
CODEX_EMAIL_USE_SSL
to
true
for SMTPS (typically port 465) and
CODEX_EMAIL_USE_TLS
to
true
for STARTTLS. Do not set both
CODEX_EMAIL_USE_TLS
and
CODEX_EMAIL_USE_SSL
to
true
.
将以下行添加到
~/.bashrc
(Linux)或
~/.zshrc
(macOS)中:
export CODEX_MACHINE_NAME="Machine-name" # 例如:Macbook
export CODEX_EMAIL_SMTP_HOST="smtp.example.com"
export CODEX_EMAIL_SMTP_PORT="587"
export CODEX_EMAIL_USERNAME="user@example.com"
export CODEX_EMAIL_PASSWORD="..."
export CODEX_EMAIL_FROM="user@example.com"
export CODEX_EMAIL_TO="recipient1@example.com,recipient2@example.com"
export CODEX_EMAIL_USE_TLS="false" # true/false,默认值为false
export CODEX_EMAIL_USE_SSL="true" # true/false,默认值为true
如果你的SMTP服务器不需要认证,请留空
CODEX_EMAIL_USERNAME
CODEX_EMAIL_PASSWORD
。 对于SMTPS(通常端口为465),请将
CODEX_EMAIL_USE_SSL
设置为
true
;对于STARTTLS,请将
CODEX_EMAIL_USE_TLS
设置为
true
。 请勿同时将
CODEX_EMAIL_USE_TLS
CODEX_EMAIL_USE_SSL
设置为
true

2) Add instruction in project AGENTS.md

2) 在项目的AGENTS.md中添加指令

For example, add this instruction to AGENTS.md:
Use skill email-notify to notify users when each agent run is finished or when any notifications would be sent to users.
例如,将以下指令添加到AGENTS.md中:
当每个agent运行结束或需要向用户发送任何通知时,使用skill email-notify来通知用户。

Workflow

工作流程

1) Provide a project name source (optional)

1) 提供项目名称来源(可选)

  • To override the folder name, define a project name in
    AGENTS.md
    using one of:
    • YAML frontmatter:
      project_name: My Project
      (or
      name:
      )
    • A plain line:
      Project Name: My Project
  • If no name is found, the script uses the project folder name.
  • 若要覆盖文件夹名称,可在
    AGENTS.md
    中通过以下方式定义项目名称:
    • YAML前置元数据:
      project_name: My Project
      (或
      name:
    • 普通行:
      Project Name: My Project
  • 如果未找到名称,脚本将使用项目文件夹名称。

2) Send the notification at task completion

2) 在任务完成时发送通知

  • Generate a short task title (3-8 words).
  • Pick an execution status:
    success
    ,
    failed
    ,
    partial
    ,
    blocked
    , etc.
  • Write a brief result summary; avoid secrets.
Run:
bash
python3 ~/.codex/skills/email-notify/scripts/send_email_notification.py \
  --task-title "..." \
  --status "success" \
  --summary "..." \
  --project-name "..."
  • 生成简短的任务标题(3-8个单词)。
  • 选择执行状态:
    success
    failed
    partial
    blocked
    等。
  • 编写简短的结果摘要;避免包含敏感信息。
运行以下命令:
bash
python3 ~/.codex/skills/email-notify/scripts/send_email_notification.py \
  --task-title "..." \
  --status "success" \
  --summary "..." \
  --project-name "..."

Resources

资源

  • scripts/send_email_notification.py
    : Send the email notification and resolve the project name.
  • scripts/send_email_notification.py
    : 发送邮件通知并解析项目名称。