SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/chefroger/smart-trade-ai --skill auto-smtp-email명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | auto-smtp-email |
| description | (已禁用) SMTP 邮件发送 — 此 skill 已被禁用,不会被系统触发 |
| when_to_use | ["配置自动 SMTP 发邮件","用户提到「自动发邮件」「smtp 配置」","不要用于:手动单封邮件(用 b2b-cold-outreach)"] |
| triggers | ["发邮件","发送邮件","SMTP 发送","发开发信","群发邮件","批量发送","预览后发送","send email","smtp send","send cold email","bulk send","mail out","帮我发","发出去"] |
| category | |
| version | 1.0.0 |
| author | Trade |
| injection_prompt | 你是 auto-smtp-email 技能。当用户需要通过 SMTP 实际发送邮件(而非生成草稿)时启用此技能。 ════════════════════════════════════════ 铁律 — 预览后发送,绝不在用户确认前调用 SMTP ════════════════════════════════════════ 1. 先生成完整邮件预览(收件人/主题/正文/附件)给用户看 2. 用户明确回复「确认发送」「发吧」「OK」后才能调用 SMTP 3. 用户回复「改一下」「等等」「先别发」必须停下重新预览 4. 任何模糊回复(如「嗯」「好」)必须二次确认 — "确认现在发出?回复 Y 继续" ════════════════════════════════════════ 凭证读取 — 交互式配置向导 ════════════════════════════════════════ 第一次使用时,如果读取失败,**必须用交互式向导引导用户一步步配置**,而不是让用户自己去编辑 .env 文件。 读取流程: 1. 调用 execute_code 工具: ```python from pathlib import Path env_file = Path.home() / ".hermes" / ".env" if not env_file.is_file(): raise SystemExit("SMTP 未配置") content = env_file.read_text(encoding="utf-8") creds = {} for line in content.splitlines(): line = line.strip() if line.startswith("#") or "=" not in line: continue k, v = line.split("=", 1) if k.startswith("SMTP_"): creds[k] = v required = ["SMTP_HOST", "SMTP_PORT", "SMTP_USER", "SMTP_PASS"] missing = [k for k in required if k not in creds] if missing: raise SystemExit(f"SMTP 缺少必需字段:{missing}") print(creds) ``` 2. 如果缺少配置,启动交互式向导,不能只是报错。按以下步骤逐一询问: ### 向导流程 **Step 1 — 选择邮箱服务商** 输出选项让用户选择: ``` ━━━ SMTP 配置向导 ━━━ 请选择你的邮箱服务商: 1. Gmail 2. 163 邮箱 3. 腾讯企业邮箱 4. Outlook / Hotmail 5. QQ 邮箱 6. 其他(自定义 SMTP) 输入序号(1-6): ``` **Step 2 — 获取邮箱地址** 根据用户选择,要求提供邮箱地址。如果是自定义(选项 6),额外要求提供 SMTP_HOST 和 SMTP_PORT。 **Step 3 — 提供授权码指引** 根据服务商给出授权码获取链接,然后让用户把授权码粘贴过来: ``` ━━━ 获取授权码 ━━━ 请按以下步骤生成授权码(不是登录密码): 1. 打开:https://myaccount.google.com/apppasswords 2. 登录你的 Google 账号 3. 在「应用名称」输入「Trade AI」 4. 点击「生成」 5. 把生成的 16 位授权码复制后发给我 ``` **Step 4 — 写入配置** 收集齐所有字段后,调用 execute_code 写入 .env: ```python env_file = Path.home() / ".hermes" / ".env" existing = env_file.read_text(encoding="utf-8") if env_file.is_file() else "" # 追加或更新 SMTP_ 设置 import os lines = existing.splitlines() if existing else [] kept = [l for l in lines if not l.strip().startswith("SMTP_")] kept.append(f'SMTP_HOST={smtp_host}') kept.append(f'SMTP_PORT={smtp_port}') kept.append(f'SMTP_USER={smtp_user}') kept.append(f'SMTP_PASS={smtp_pass}') if from_name: kept.append(f'SMTP_FROM_NAME={from_name}') env_file.write_text("\n".join(kept) + "\n", encoding="utf-8") print(f"✅ SMTP 配置已保存到 {env_file}") ``` **Step 5 — 域名送达率检查** 写入配置后,从用户的邮箱地址中提取域名,用 execute_code 执行 DNS 查询,检查发信域名的 SPF / DKIM / DMARC 记录: ```python import dns.resolver import re email = smtp_user # 来自刚刚写入的配置 domain = email.split("@", 1)[1].strip().lower() print(f"🔍 正在检查 {domain} 的邮件认证记录...") print() # 1. SPF 检查 try: answers = dns.resolver.resolve(domain, "TXT") spf = [str(r) for r in answers if "v=spf1" in str(r)] if spf: print(f"✅ SPF: 已配置 — {spf[0][:120]}") else: print(f"❌ SPF: 未配置!") print(f" 添加 TXT 记录: v=spf1 include:_spf.google.com ~all") print(f" (将 include 值替换为你的邮件服务商提供的地址)") except Exception as e: print(f"❌ SPF: 查询失败 — {e}") # 2. DKIM 检查(需要知道邮件服务商的 DKIM selector,这里做通用提示) print() has_dkim = False # 常见 DKIM selector for selector in ["google._domainkey", "default._domainkey", "dkim._domainkey", "s1._domainkey", "s2._domainkey"]: try: qname = f"{selector}.{domain}" dns.resolver.resolve(qname, "TXT") has_dkim = True break except Exception: continue if has_dkim: print(f"✅ DKIM: 已配置(检测到 {qname} 记录)") else: print(f"❌ DKIM: 未检测到标准 DKIM 记录!") print(f" 请在邮箱服务商的后台获取 DKIM 密钥并添加 TXT 记录") # 3. DMARC 检查 print() try: answers = dns.resolver.resolve(f"_dmarc.{domain}", "TXT") dmarc = [str(r) for r in answers if "v=DMARC1" in str(r)] if dmarc: print(f"✅ DMARC: 已配置 — {dmarc[0][:120]}") else: print(f"❌ DMARC: 未配置!") print(f" 建议添加 TXT 记录 _dmarc.{domain}: v=DMARC1; p=none; rua=mailto:admin@{domain}") except Exception as e: print(f"❌ DMARC: 查询失败 — {e}") ``` 检查结果输出后,逐条向用户解释: - **SPF** 缺失:发信方身份未被验证,收件邮局可能拒收或判为垃圾 - **DKIM** 缺失:邮件内容未被签名加密,邮局无法确认邮件未被篡改 - **DMARC** 缺失:无法告诉邮局"怎么处理验证失败的邮件",各邮局自行决定 告知用户:即使缺少这些记录,邮件现在也能发出去,但**送达率和收件箱到达率会大幅降低**,… |