Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Effect KitEmails

Messages

Build the message you pass to email.send and learn what it accepts and rejects.

A message is a plain object. email.send validates it, checks it against the provider's capabilities, then submits it.

Example (Sending a Message With Names, Copies and Headers)

import {  } from "effect";
import {  } from "@effect-kit/emails";

const  = .(function* () {
  const  = yield* ;
  const  = yield* .({
    : { : "hello@example.com", : "Example Team" },
    : [{ : "ada@example.com", : "Ada" }, "grace@example.com"],
    : "support@example.com",
    : "support@example.com",
    : "Your order has shipped",
    : "Order 1042 is on its way.",
    : "<p>Order 1042 is on its way.</p>",
    : { "X-Order-Id": "1042" },
  });
  return receipt.;
const receipt: {
    readonly provider: string;
    readonly status: "accepted" | "partiallyAccepted";
    readonly references: readonly {
        readonly kind: "operationId" | "providerMessageId" | "smtpMessageId";
        readonly value: string;
    }[];
    readonly requestId?: string | undefined;
    readonly recipients?: ... | undefined;
}
});

Fields

FieldTypeNotes
fromaddressOne sender
toaddress or listRequired. A list must not be empty
cc, bcc, replyToaddress or listOptional. A list must not be empty
subjectstringNot blank, no control characters
text, htmlstringAt least one is required. Not blank
headersrecord of stringsCustom headers only
attachmentslistSee Attachments

These fields are the whole model. There are no tags, metadata, scheduling, template id or per-recipient data fields.

Unknown keys are rejected

A key outside the table, such as tags or metadata, fails the send with InvalidMessageError and acceptance: "notSubmitted". It is never silently dropped.

Addresses

An address is either a bare email string or a Mailbox object with an email and an optional name. A string like "Ada <ada@example.com>" is invalid: put the display name in the name field.

The email must be ASCII, at most 254 characters, with a local part of at most 64. Internationalized domains and quoted local parts are not accepted.

to, cc, bcc and replyTo take one address or a non-empty list. Whether a provider accepts a display name or more than one reply-to depends on its capabilities.

Headers

Header names are unique ignoring case, and values cannot contain control characters. These names are reserved and rejected:

from, sender, to, cc, bcc, reply-to, subject, date, message-id, mime-version, return-path, received, authentication-results, dkim-signature, authorization, proxy-authorization, host, idempotency-key, x-smtpapi

Names that start with content-, resent-, resend-, x-ses-, x-mc-, x-mailgun-, x-mailin- or x-pm- are also rejected.

Send options

email.send takes a second argument, SendOptions, whose only field is idempotencyKey. Only some providers support it, so check Choosing a provider.