# extension-email

Sends service and transactional emails from a Caffeine app, such as order confirmations, with one copy per recipient.

Skill by Caffeine. Category: Documents.

## Install

Project (for this project only):

```sh
npx skills add caffeinelabs/skills --skill extension-email
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add caffeinelabs/skills --skill extension-email -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass
- ZeroLeaks: Pass

Installs: 25223. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/caffeinelabs/skills/extension-email)

## Source

[Open the source](https://github.com/caffeinelabs/skills/tree/HEAD/skills/extension-email). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: extension-email
description: Support for sending service/transactional emails. Don't use this for sending marketing emails or verification emails.
version: 0.3.0
compatibility:
  mops:
    caffeineai-email: "~0.3.0"
caffeineai-subscription: [plus, pro]
---

# Email — Service/Transactional
Service/transactional email extension for [Caffeine AI](https://caffeine.ai?utm_source=caffeine-skill&utm_medium=referral).

## Overview

This skill adds support for sending service and transactional emails from the backend canister. Use `sendServiceEmail` for order confirmations, notifications, and similar one-off emails.

# Backend

This component is for sending service/transactional emails. 

There is the prefabricated module `mo:caffeineai-email/emailClient.mo` which cannot be modified.

- Use the sendServiceEmail function. 
- Each recipient is sent an individual email
- It returns a SendResult which is #ok if the email is sent successfully otherwise #err(error) with the error text. 

```mo:caffeineai-email/emailClient.mo
module {
  public type SendResult = {
    #ok;
    #err : Text;
  };

  public func sendServiceEmail(
    fromUsername : Text,
    recipients : [Text],
    subject : Text,
    htmlBody : Text,
  ) : async SendResult;
};
```

Usage for `sendServiceEmail`:

```motoko filepath=src/backend/main.mo
import Runtime "mo:core/Runtime";
import EmailClient "mo:caffeineai-email/emailClient";

actor {
  public func sendOrderConfirmationEmail(recipientEmailAddress : Text, username : Text, orderReference : Text) : async () {
    let result = await EmailClient.sendServiceEmail(
      "no-reply",
      [recipientEmailAddress],
      "Order " # orderReference # " confirmed",
      "Hello " # username # ",\nYour order " # orderReference # " has been confirmed. Your items will ship tomorrow.",
    );
    switch (result) {
      case (#ok) {};
      case (#err(error)) {
        Runtime.trap("Failed to send order confirmation email: " # error);
      };
    };
  };
};
```

## Upgrading from the previous version

An app built with `caffeineai-email` 0.2.x re-pins with `mops add caffeineai-email@0.3.0`. `sendServiceEmail` and `sendRawEmail` keep their signatures; every send now carries an idempotency key, so a retried outcall is sent and charged once. Apps that use verification or marketing email follow the upgrade sections of those skills.
````

- Previous: [extension-email-verification](https://syn4pse.dev/terminal/caffeine-extension-email-verification.md)
- Next: [extension-object-storage](https://syn4pse.dev/terminal/caffeine-extension-object-storage.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
