extension-email
このスキルは、バックエンドからサービスメールやトランザクションメールを送信することを可能にします。注文確認や通知などの重要な情報をタイムリーにユーザーに届け、ユーザーエクスペリエンスとシステムの信頼性を向上させるため、開発者がメール送信機能を簡単に統合できる簡素化されたインターフェースを提供します。
npx skills add https://github.com/caffeinelabs/skills --skill extension-emailBefore / After 効果比較
1 组このスキルがない場合、開発者はサードパーティのメールサービスを手動で統合し、API呼び出し、エラー処理、受信者管理のために多くのコードを記述する必要がありました。これは時間がかかり、エラーが発生しやすく、機能のリリースを遅らせていました。
この Skill は簡潔なインターフェースを提供し、開発者は単一の関数呼び出しでサービスメールを送信できます。これにより、統合プロセスが大幅に簡素化され、開発作業と潜在的なエラーが削減され、機能の展開が加速されます。
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.
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);
};
};
};
};
ユーザーレビュー (0)
レビューを書く
レビューなし
統計データ
ユーザー評価
この Skill を評価