LOOMAL
For Buyers

Send your first email

Send a message from your agent's inbox using the Loomal SDK

Every Loomal project gets an inbox at <prefix>@mailgent.dev — a real domain your agent can send from and receive at. This page walks the Buyer side: install the SDK and send a complete message.

Before you start

  • A project at console.loomal.ai with Mail turned on.
  • Your project's API key (loid-...) and inbox address (e.g., agent-x8k2m@mailgent.dev), both shown on the project's Mail tab.
npm install @loomal/sdk      # Node, Bun, Deno
pip install loomal-sdk       # Python

Send a message

The full surface of loomal.mail.send in one example — recipients, CC, BCC, plain text, and HTML. to is required and must be a string array; text is required (used as the plain-text fallback when the recipient's client can't render HTML); html, cc, and bcc are optional.

send.ts
import { Loomal } from "@loomal/sdk";

const loomal = new Loomal({ apiKey: process.env.LOOMAL_API_KEY! });

const msg = await loomal.mail.send({
  to: ["primary@example.com"],
  cc: ["manager@example.com"],
  bcc: ["archive@example.com"],
  subject: "Weekly report",
  text: "Highlights: 12 deals moved, 3 closed.",
  html: "<h1>Weekly report</h1><p>Highlights: 12 deals moved, 3 closed.</p>",
});

console.log(msg.messageId, msg.threadId, msg.inboxId);
send.py
import os
from loomal import Loomal

loomal = Loomal(api_key=os.environ["LOOMAL_API_KEY"])

msg = loomal.mail.send(
    to=["primary@example.com"],
    cc=["manager@example.com"],
    bcc=["archive@example.com"],
    subject="Weekly report",
    text="Highlights: 12 deals moved, 3 closed.",
    html="<h1>Weekly report</h1><p>Highlights: 12 deals moved, 3 closed.</p>",
)

print(msg.message_id, msg.thread_id, msg.inbox_id)

Run with LOOMAL_API_KEY=loid-.... The response gives you messageId (RFC 5322 format, e.g., <abc123@mailgent.dev>), threadId, and the inboxId it was sent from. The message shows up in the Mail tab under Sent within a second or two.

Drop any field you don't need — sending plain text to a single recipient is just to + subject + text. CC recipients see each other on the message; BCC recipients don't.

What's next

On this page