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

ZeptoMail

Send email through ZeptoMail with the @effect-kit/emails/zeptomail Layer.

The @effect-kit/emails/zeptomail subpath sends messages through ZeptoMail and provides the Email service.

Installation

npm install @effect-kit/emails effect zeptomail@8.0.1

The SDK is a pinned optional peer. It is needed only when you import this subpath.

Setup

ZeptoMail.layerConfig() reads these variables:

VariableRequiredValue
ZEPTOMAIL_TOKENyesSend mail token
ZEPTOMAIL_URLyesFull API URL, for example https://api.zeptomail.com/v1.1/email

Example (Sending a Message With ZeptoMail)

import { , ,  } from "effect";
import {  } from "@effect-kit/emails";
import * as  from "@effect-kit/emails/zeptomail";

const  = .().(
  .(.(.())),
);

const  = .(function* () {
  const  = yield* ;
  return yield* .({
    : "hello@example.com",
    : "ada@example.com",
    : "Welcome",
    : "Your account is ready.",
  });
});

.(.(.()));

Use a from address your ZeptoMail account is allowed to send from.

Options

ZeptoMail.layer takes these options. layerConfig builds the same object from a Config.

Prop

Type

Capabilities

ZeptoMail reports this in email.capabilities:

TextHTMLBothSender nameCcBccReply-toHeadersAttachmentsInline imagesIdempotency
yesyesyesyesyesyesmultipleyesyesyesno

These fail with UnsupportedFeatureError and acceptance: "notSubmitted" before any request:

  • An idempotencyKey (feature idempotency).

Idempotency

Not supported. A key fails with UnsupportedFeatureError before sending.

Provider notes

  • url has no default because the host depends on the Zoho data centre of your account. Both layerConfig and layer need it.
  • The package adds the Zoho-enczapikey prefix to the token, so pass only the token.
  • ZeptoMail returns a request id and no message id. The receipt's references is empty and requestId holds the request id.

Using your own client

layerClient takes any object with sendMail(message), which a SendMailClient has. options is optional.

Example (Borrowing a ZeptoMail Client)

import { SendMailClient } from "zeptomail";
import * as ZeptoMail from "@effect-kit/emails/zeptomail";

const client = new SendMailClient({
  url: "https://api.zeptomail.com/v1.1/email",
  token: "Zoho-enczapikey fake-token",
});

const EmailLive = ZeptoMail.layerClient(client);

You own a borrowed client. The Layer never closes it, and the client keeps its own retry, timeout and logging policy. A borrowed client carries its own token, so include the prefix there if the SDK needs it.

Errors

ProviderConfigurationError carries provider: "zeptomail" and a field naming the bad option. Layer construction fails with it, and layerClient fails with it for the client options.

fieldRaised when
timeoutThe timeout is not finite and positive.
tokenThe token is not printable ASCII without spaces.
urlThe URL is not http or https, has credentials, a query or a fragment, or its path is not /v1.1/email.
ZeptoMail failureReason
SDK network errorTransportError
SDK timeout errorTimeoutError
SDK authentication errorAuthenticationError (acceptance: "rejected")
SDK validation error, or a local validation stringInvalidMessageError (acceptance: "notSubmitted")
Error code TM_3004InvalidMessageError (acceptance: "rejected")
Any other error code in the responseProviderError (acceptance: "rejected")

An API error from the SDK uses its HTTP status with the shared mapping. A response that is not valid JSON fails with UnexpectedResponseError. Kept providerCode values are TM_3004 and AUTHENTICATION_ERROR.