Логотип Email Connector

Email Connector

Спільнота
ericrisco
email-connector

Use when wiring server code to send transactional or bulk email via Resend, SendGrid, or Postmark: a provider-agnostic sendEmail() seam, idempotent retries, 100-cap batches with partial failures, transactional-vs-broadcast streams, bounce webhooks feeding a suppression list. NOT SPF/DKIM/DMARC inbox reputation (that is `email-deliverability`).

Add to TypingMind

Огляд

Видавецьericrisco
Репозиторійrsc-harness
Назва навичкиemail-connector
Зірки
239
Форки
24
Файли в пакеті
3
ЛіцензіяMIT
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Файлів у комплекті: 3

    Скрипти, шаблони й довідкові матеріали, які модель може читати під час роботи. Файли доступні лише для читання й ніколи не виконуються.

  • Відкритий вихідний код

    Видавець на GitHub: ericrisco. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Email Connector у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/ericrisco/rsc-harness/tree/main/skills/email-connector
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ericrisco/rsc-harness.git /tmp/rsc-harness
mkdir -p .claude/skills
cp -r /tmp/rsc-harness/skills/email-connector .claude/skills/email-connector
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Email Connector в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Email Connector, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Email Connector не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

email-connector — put transactional & bulk email on the wire

You wire the send. A welcome mail, a password reset, a receipt, a 4,000-row digest — your job is the server code that hands it to a provider, makes it safe to retry, and keeps the suppression list honest. You do not own the inbox (SPF/DKIM/DMARC/reputation is ../email-deliverability/SKILL.md) and you do not own the words (subject lines and growth are ../newsletter/SKILL.md, launch copy is ../marketing/SKILL.md). Generic typed clients for any REST API are ../api-connector-builder/SKILL.md; deciding when a multi-step sequence fires is ../automation-flows/SKILL.md.

Stack as of June 2026: resend 6.12.4, @sendgrid/mail 8.1.6, Postmark via its HTTP API, React Email 5.0 (React 19.2 / Next.js 16, Tailwind 4), Node 20+ / TS.

scripts/verify.sh is read-only and greps a target for the four invariants this skill exists to hold: env-sourced key, idempotency, a single sendEmail() seam, and a webhook signature checked on the raw body.

Step 1 — pick a provider

ProviderBest default fitNative idempotencyTemplate modelBatch capPick when
ResendGreenfield, React/Next shopsYes — { idempotencyKey }, 24h, ≤256 charsReact Email JSX via react:100/callYou want JSX templates and the least ceremony
SendGrid (Twilio)High volume, marketing+txn mixNo — dedupe yourselfd- dynamic templates + dynamicTemplateDataper-send personalizationsYou need 10k req/s scale or already on Twilio
PostmarkPure transactional, deliverability-firstNo — self-dedupe via your key + webhooksPostmark server templatesper-streamReceipts/resets must never queue behind marketing

Idempotency support changes your strategy, not just your config — see Step 4. Full per-provider matrix (auth header, SDK + version, single/batch signatures, idempotency model, stream/subdomain model, dynamic-template syntax, webhook event names, rate limits, when to pick each) plus a suppression-webhook handler skeleton per provider is in references/providers.md.

Step 2 — the sendEmail() seam

One provider-agnostic function. The rest of the app calls sendEmail(...) and never imports a provider SDK. Why: swapping SendGrid→Postmark is then one file, not a grep across every call site. That one file reads the key from process.env — never a re_… / SG.… / server-token literal, because a committed key is a send-as-you credential and burns your reputation with it.

ts
// lib/email/index.ts — the only place a provider SDK is imported
export type SendArgs = {
  to: string | string[];
  subject: string;
  react?: React.ReactElement; // template component
  html?: string;
  text?: string;
  idempotencyKey: string;     // required for transactional sends
  stream?: 'transactional' | 'broadcast';
};
export async function sendEmail(args: SendArgs): Promise<{ id: string }> { /* provider impl */ }
ts
// lib/email/resend.ts
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);

export async function sendEmail(a: SendArgs) {
  const { data, error } = await resend.emails.send(
    { from: 'YourApp <noreply@notify.yourdomain.com>', to: a.to, subject: a.subject, react: a.react, html: a.html, text: a.text },
    { idempotencyKey: a.idempotencyKey }, // 2nd arg, retained 24h, ≤256 chars
  );
  if (error) throw new Error(error.message);
  return { id: data!.id };
}
ts
// lib/email/sendgrid.ts
import sgMail from '@sendgrid/mail';
sgMail.setApiKey(process.env.SENDGRID_API_KEY!);

export async function sendEmail(a: SendArgs) {
  const [res] = await sgMail.send({
    from: 'noreply@notify.yourdomain.com',
    to: a.to, subject: a.subject, html: a.html, text: a.text,
    // SendGrid has no idempotency key — guard with your own dedupe (Step 4)
  });
  return { id: res.headers['x-message-id'] };
}
ts
// lib/email/postmark.ts — raw HTTP, X-Postmark-Server-Token header
export async function sendEmail(a: SendArgs) {
  // Postmark has no idempotency key: self-dedupe BEFORE calling (Step 4)
  const r = await fetch('https://api.postmarkapp.com/email', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
      'X-Postmark-Server-Token': process.env.POSTMARK_SERVER_TOKEN!,
    },
    body: JSON.stringify({
      From: 'noreply@notify.yourdomain.com',
      To: Array.isArray(a.to) ? a.to.join(',') : a.to,
      Subject: a.subject, HtmlBody: a.html, TextBody: a.text,
      MessageStream: a.stream === 'broadcast' ? 'broadcast' : 'outbound',
    }),
  });
  if (!r.ok) throw new Error(`Postmark ${r.status}`);
  return { id: (await r.json()).MessageID };
}

Bad → Good:

ts
// Bad — provider SDK called directly in a route handler, key inline
import { Resend } from 'resend';
await new Resend('re_live_123abc').emails.send({ to, subject, html });
ts
// Good — call the seam; key is in env, swap is one file
import { sendEmail } from '@/lib/email';
await sendEmail({ to, subject, react: <Welcome name={n} />, idempotencyKey });

Step 3 — templates

Templates are typed components, not string concat. Why: JSX escapes interpolated values; hand-built HTML invites injection and broken markup.

React Email 5.0 renamed renderAsync → render. The Resend SDK lazily imports @react-email/render when you pass react:, so you usually pass the component directly and skip manual rendering.

tsx
// emails/welcome.tsx
import { Html, Button, Text } from '@react-email/components';
export function Welcome({ name, url }: { name: string; url: string }) {
  return (
    <Html>
      <Text>Welcome, {name}.</Text>
      <Button href={url}>Confirm your email</Button>
    </Html>
  );
}
ts
// SendGrid: dynamic template referenced by a d- id, data passed separately
await sgMail.send({
  to, from: 'noreply@notify.yourdomain.com',
  templateId: 'd-abc123...',                  // dynamic template id starts with d-
  dynamicTemplateData: { name, confirm_url },  // values, not pre-rendered HTML
});
ts
// Bad — string concat, unescaped user input straight into HTML
const html = '<h1>Hi ' + req.body.name + '</h1>'; // XSS + broken layout risk

Step 4 — idempotency & retries

Every transactional send carries a key, because queues retry, serverless functions re-fire, and users double-click — without a stable key one password reset becomes three. Derive it from the event, not the clock. Same event → same key → provider (or your table) collapses the duplicate.

ts
const idempotencyKey = `pwreset:${userId}:${tokenVersion}`; // stable across retries
  • Resend: native. Pass { idempotencyKey } as the 2nd arg; retained 24h, ≤256 chars. For a batch, the key represents the whole batch (e.g. team-quota/123456789), not each row.
  • Postmark / SendGrid: no idempotency feature. You must self-dedupe: write the key to a sent_emails table inside the same transaction as the send, unique-constrain it, and skip if it already exists.
ts
// Self-dedupe seam for providers without native keys
const inserted = await db.sentEmails.insertIfAbsent({ key: idempotencyKey });
if (!inserted) return; // already sent — do not re-fire
await sendEmail({ to, subject, html, idempotencyKey });
ts
// Bad — no key; queue retry sends the reset 3×
await sendEmail({ to, subject, react: <Reset url={url} /> } as any);

Step 5 — batch / bulk

resend.batch.send([...]) is capped at 100 emails per call and forbids attachments/scheduling. Chunk larger runs, then inspect both arrays for partial failure — a 200 response can still contain per-row errors.

Checklist for a bulk run:

  • Filter the recipient list against the suppression list (Step 7) first.
  • Chunk into ≤100; one idempotencyKey per chunk.
  • Use batchValidation: 'permissive' so one bad address does not nuke the chunk.
  • Iterate results: collect succeeded ids and failed rows separately.
  • Re-queue only the failed rows; never replay the whole chunk.
ts
function chunk<T>(xs: T[], n = 100) { const o: T[][] = []; for (let i = 0; i < xs.length; i += n) o.push(xs.slice(i, i + n)); return o; }

for (const [i, group] of chunk(recipients).entries()) {
  const { data } = await resend.batch.send(
    group.map((r) => ({ from, to: r.email, subject, react: <Digest items={r.items} /> })),
    { idempotencyKey: `digest-2026-06/${i}`, batchValidation: 'permissive' },
  );
  data?.data?.forEach((d) => markSent(d.id));      // succeeded rows
  // inspect per-row errors and re-queue only those — do not replay the chunk
}

Step 6 — transactional vs broadcast split

Reputation isolation. Give each stream a distinct From, subdomain, and stream/IP so they cannot poison each other:

StreamFromSubdomainProvider stream
Transactionalnoreply@notify.yourdomain.comnotify.Resend default / Postmark outbound
Broadcastnews@promo.yourdomain.compromo.dedicated marketing stream / broadcast

Why: a marketing send that trips a blocklist must never take password resets down with it. The DNS/auth setup for those subdomains is ../email-deliverability/SKILL.md's job; you just send on the right one.

Step 7 — delivery/bounce/complaint webhook → suppression

The provider POSTs bounce and complaint events. Verify the signature on the raw body (parse after verifying), then write the address to a suppression list and check that list before every future send. The verification is absolute because this hook mutates the suppression list: unverified, anyone can suppress — or un-suppress — your users.

ts
// app/api/email/webhook/route.ts (Next.js 16) — verify BEFORE parsing
export async function POST(req: Request) {
  const raw = await req.text();                       // raw body, not req.json()
  if (!verifyProviderSignature(raw, req.headers)) return new Response('bad sig', { status: 401 });
  const event = JSON.parse(raw);
  if (event.type === 'email.bounced' || event.type === 'email.complained') {
    await db.suppressions.upsert({ email: event.data.to, reason: event.type });
  }
  return new Response('ok');
}
ts
// Before any send: skip suppressed addresses
const recipients = candidates.filter(async (e) => !(await db.suppressions.has(e)));

Generic webhook hardening (replay windows, queueing, retries beyond email) is ../webhooks/SKILL.md. The address-validity question (is this mailbox real before I ever send) is ../lead-gen/SKILL.md / ../email-deliverability/SKILL.md.

Anti-patterns

Anti-patternWhy it bitesDo instead
API key hard-coded (re_…, SG.…, server token)Committed credential = send-as-you abuseRead from process.env; rotate via ../secure-coding/SKILL.md
No idempotency key on transactional sendsQueue/serverless retry double-sendsDeterministic event:userId:version key
One stream for everythingMarketing hit poisons reset/receipt deliverabilitySplit From + subdomain + stream (Step 6)
String-concatenated HTML with user inputXSS + broken layoutReact Email component or d- dynamic template
Ignoring per-row data.errors in a batchSilent partial loss; "looked like 200"Inspect both arrays; re-queue only failures
Trusting the webhook without signature checkAnyone can poison your suppression listVerify signature on raw body, then parse
Sending to a bounced/complained addressReputation damage, ISP penaltiesFilter against suppression list before send
Calling the provider SDK at scattered call sitesProvider swap = grep across the appOne sendEmail() seam (Step 2)

Файли в пакеті

Модель читає ці файли за потреби, поки навичку завантажено. Вони доступні для читання й ніколи не виконуються.

Поширені запитання

Що робить навичка ШІ Email Connector?

Use when wiring server code to send transactional or bulk email via Resend, SendGrid, or Postmark: a provider-agnostic sendEmail() seam, idempotent retries, 100-cap batches with partial failures, transactional-vs-broadcast streams, bounce webhooks feeding a suppression list. NOT SPF/DKIM/DMARC inbox reputation (that is `email-deliverability`).

Навіщо використовувати Email Connector у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Email Connector — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Email Connector у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/ericrisco/rsc-harness/tree/main/skills/email-connector. TypingMind прочитає файл SKILL.md, додасть супровідні файли та встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Email Connector?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Email Connector?

Зі скількома забажаєте. У TypingMind ви можете використовувати Email Connector із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Email Connector?

Так. На GitHub цю навичку публікує ericrisco за ліцензією MIT. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі
Логотип bytedance

Consulting Analysis

bytedance
ОрганізаціяПопулярне

Використовуйте цей навик, коли користувач просить згенерувати, створити або написати професійний аналітичний звіт, зокрема про аналіз ринку, споживчі інсайти, бренд, фінанси…

11.4K
82.6K
Інструкції
Відкрити
Логотип bytedance

Github Deep Research

bytedance
ОрганізаціяПопулярне

Проводьте багатоетапне глибоке дослідження будь-якого репозиторію GitHub. Використовуйте цю навичку, коли користувач просить провести всебічний аналіз, відтворити хронологію, виконати конкурентний аналіз або детально дослідити GitHub. Результат…

11.4K
82.6K
Файлів: 2
Відкрити
Логотип ComposioHQ

Changelog Generator

ComposioHQ
ОрганізаціяПопулярне

Автоматично створює орієнтовані на користувачів журнали змін на основі комітів git: аналізує історію комітів, класифікує зміни й перетворює технічні коміти на зрозумілі нотатки до релізу. Скорочує…

8.7K
75.2K
Інструкції
Відкрити
Логотип thedaviddias

Ai Content

thedaviddias
СпільнотаПопулярне

Використовуйте під час аудиту метаданих, доступності для сканування, структурованих даних або індексації, щоб перевіряти й удосконалювати контент, створений ШІ. Перевіряйте відображений HTML і HTTP-відповідь, а не покладайтеся лише на…

6.7K
74.2K
Файлів: 1
Відкрити

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇