extension-email

작성자: caffeinelabs

서비스/트랜잭션 이메일 전송을 지원합니다. 마케팅 이메일이나 인증 이메일 전송에는 사용하지 마세요.

npx skills add https://github.com/caffeinelabs/skills --skill extension-email

Email — Service/Transactional

Service/transactional email extension for Caffeine AI.

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.
  • A failed send never throws. Every failure, a gateway error included, comes back as #err.
module {
  public type SendResult = {
    #ok;
    #err : Text;
  };

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

Usage for sendServiceEmail:

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.4.x re-pins with mops add caffeineai-email@0.5.0. sendServiceEmail and sendRawEmail keep their signatures. 0.5.0 compiles with ic 5.0.0, where 0.4.x fails. In an app that pins ic 5.0.0, its gateway calls use outcall pricing version 2; on ic 4.2.0 they keep version 1. gatewayConfig returns the mail client 0.7.0 Config, whose cycles is optional and which adds pricing_version. Apps that use verification, marketing or calendar email follow the upgrade sections of those skills.

An app built with caffeineai-email 0.3.x re-pins with mops add caffeineai-email@0.4.0. sendServiceEmail and sendRawEmail keep their signatures. Every send now goes through the mail gateway with the settings the platform injects on every deploy (INTEGRATIONS_GATEWAY_URL / INTEGRATIONS_GATEWAY_API_KEY); the transport canister and INTEGRATIONS_CANISTER_ID are no longer used, and a send without those settings returns #err instead of falling back. Apps that use verification, marketing or calendar email follow the upgrade sections of those skills.

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.

caffeinelabs의 다른 스킬

connector-googlemail
caffeinelabs
Use the `googlemail-client` mops package whenever the user asks the canister to send email, compose a draft, list or read Gmail messages, or fetch the authenticated user's Gmail profile. The package wraps the Gmail REST API v1 at `https://gmail.googleapis.com` via outbound HTTPS calls.
communicationapiproductivity
extension-authorization
caffeinelabs
역할 기반 접근 제어를 갖춘 인증 시스템. 개인 데이터나 접근이 제한된 데이터를 관리하는 모든 앱에 필수입니다.
securityapidevelopment
extension-camera
caffeinelabs
웹 카메라 지원.
mediavideoimage
extension-core-infrastructure
caffeinelabs
백엔드 연결 구성, 스토리지 클라이언트 및 React 앱 진입점을 제공하는 핵심 인프라.
developmentapidevops
extension-data-viewer
caffeinelabs
Admin-only paginated viewer for stable canister state. Use whenever the user asks for a viewer, dashboard, debug panel, or admin browse over backend data — users, items, orders, logs, or any stable Map/Set/Array/VarArray/List/Stack/Queue. Pre-installed in every Caffeine app via the `caffeineai-data-viewer` mops package; this skill explains what it does and how to keep using it correctly.
developmentdatabasedata-analysis
extension-email-calendar-events
caffeinelabs
이벤트/회의를 정리하고 이메일로 초대장을 보내는 기능을 지원합니다.
productivitycommunicationproject-management
extension-email-marketing
caffeinelabs
구독자에게 개인화된 마케팅 이메일을 발송하며, 수신 거부 링크를 포함합니다.
marketingcommunication
extension-email-raw
caffeinelabs
여러 수신자, 참조 및 숨은 참조 주소로 이메일을 보냅니다.
communication