# Pinme Email

Use this skill when a PinMe project (Worker TypeScript) needs to integrate email...

- Repository: https://github.com/glitternetwork/pinme (3753 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-09-12
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add glitternetwork/pinme --skill pinme-email -g -a claude-code -y`
Codex: `npx skills add glitternetwork/pinme --skill pinme-email -g -a codex -y`
Cursor: `npx skills add glitternetwork/pinme --skill pinme-email -g -a cursor -y`
Gemini CLI: `npx skills add glitternetwork/pinme --skill pinme-email -g -a gemini-cli -y`

## Description

Use this skill when a PinMe project (Worker TypeScript) needs to integrate email sending (send_email). Guides AI to generate correct Worker TS code.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# PinMe Worker Email API Integration

Guides how to call PinMe platform's email sending API in a PinMe Worker (TypeScript).

## Environment Variables

The following environment variables are automatically injected when the Worker is created, no manual configuration needed:

```typescript
// backend/src/worker.ts
export interface Env {
  DB: D1Database;
  API_KEY: string;      // Project API Key, used for send_email authentication
  BASE_URL?: string;    // Optional override for PinMe API base URL, defaults to https://pinme.cloud
}
```

> `API_KEY` is the sole credential for the Worker to call PinMe platform APIs. When `BASE_URL` is not set, it defaults to `https://pinme.cloud`.

---

## Send Email API

**Endpoint:** `POST {BASE_URL}/api/v4/send_email`
**Authentication:** `X-API-Key` header (using `env.API_KEY`)
**Sender:** Automatically set to `{project_name}@pinme.cloud`

### Request Format

```json
{
  "to": "user@example.com",
  "subject": "Your verification code",
  "html": "<p>Your code is <strong>123456</strong></p>"
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `to` | string | Yes | Recipient email address |
| `subject` | string | Yes | Email subject |
| `html` | string | Yes | HTML body |

### Response Format

**Success (200):**
```json
{ "code": 200, "msg": "ok", "data": { "ok": true } }
```

**Errors:**

| HTTP Status | Meaning | data.error Example |
|-------------|---------|-------------------|
| 401 | API Key missing or invalid | `"X-API-Key header is required"` / `"Invalid API key"` |
| 400 | Parameter validation failed | `"Invalid email address"` / `"Subject is required"` |
| 500 | Email service error | `"Failed to send email"` |

### Worker Example Code

The rest: https://github.com/glitternetwork/pinme/blob/HEAD/skills/pinme-email/SKILL.md
