Extension Email

by caffeinelabs362f51ae96f0No license2 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today

Support for sending service/transactional emails. Don't use this for sending marketing emails or verification emails.

Instructions onlyCommunication
AI-generated overview

Adds service and transactional email sending to Caffeine AI backend canisters via a prefabricated Motoko module.

What it does
This skill documents how to send service and transactional emails from a Caffeine AI backend canister using the prefabricated, unmodifiable module mo:caffeineai-email/emailClient.mo. It covers the sendServiceEmail function, which takes a from username, recipient list, subject and HTML body, sends each recipient an individual email, and returns a SendResult of #ok or #err with error text. It also includes a Motoko usage example for an order confirmation email and upgrade notes for moving from caffeineai-email 0.2.x to 0.3.0, where sends now carry an idempotency key.
When to use it
Use it when building a Caffeine AI app that needs to send one-off service or transactional emails such as order confirmations and notifications. It is explicitly not intended for marketing emails or verification emails, which are covered by other skills.
Requirements
Requires the Caffeine AI platform with the caffeineai-email Mops dependency at version ~0.3.0 and a plus or pro subscription. It ships no scripts; it is instructions only, and the referenced emailClient.mo module cannot be modified.

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.
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
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 [email protected]. 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.

Source and attribution

Source:caffeinelabs/skillsinskills/extension-emailat commit362f51a

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal