# Mailset docs

Mailset sends your product's email from your own domain, whether your team's mail lives in Mailset or stays where it is. Sign-in codes, receipts, announcements: you call it from your server, it tells you what became of each message, and replies go wherever you point them.

Pick your language. The docs remember it and show every example in it.

- [TypeScript](https://mailset.app/docs/sdk/typescript): and JavaScript · Node.js 20+, Bun 1.4+, Deno 2.9+, Cloudflare Workers
- [Python](https://mailset.app/docs/sdk/python): Python 3.9+
- [Go](https://mailset.app/docs/sdk/go): Go 1.22+
- [Ruby](https://mailset.app/docs/sdk/ruby): Ruby 3.0+
- [PHP](https://mailset.app/docs/sdk/php): PHP 8.1+
- [Java](https://mailset.app/docs/sdk/java): Java 17+
- [Rust](https://mailset.app/docs/sdk/rust): Rust 1.88+
- [CLI](https://mailset.app/docs/cli): macOS, Linux
- [HTTP API](https://mailset.app/docs/authentication/http): Any language

Every SDK has: every public command, retries built in, timeouts per try, idempotency keys, webhook verification, credential check.

Or start from your framework. Each guide runs from install to webhooks.

- [Next.js](https://mailset.app/send-email/nextjs): TypeScript · send and webhooks
- [Express](https://mailset.app/send-email/express): TypeScript · send and webhooks
- [NestJS](https://mailset.app/send-email/nestjs): TypeScript · send and webhooks
- [Cloudflare Workers](https://mailset.app/send-email/cloudflare-workers): TypeScript · send and webhooks
- [FastAPI](https://mailset.app/send-email/fastapi): Python · send and webhooks
- [Django](https://mailset.app/send-email/django): Python · send and webhooks
- [Flask](https://mailset.app/send-email/flask): Python · send and webhooks
- [Rails](https://mailset.app/send-email/rails): Ruby · send and webhooks
- [Laravel](https://mailset.app/send-email/laravel): PHP · send and webhooks
- [Symfony](https://mailset.app/send-email/symfony): PHP · send and webhooks
- [Spring Boot](https://mailset.app/send-email/spring-boot): Java · send and webhooks

## Send your first email

1. Make a key and approve it with your passkey. If your team's mail stays where it is, the key sends as the addresses you name on your domain: `mailset keys create --send --domain example.com --from hello@example.com --name "Acme API"`, and [Send from a domain whose mail stays elsewhere](https://mailset.app/docs/recipes/sending-only) has the rest. If your team's mailboxes live in Mailset, make it for one mailbox instead: `mailset keys create --send --mailbox hello@example.com --name "Acme API"`.
2. Keep the `MAILSET_KEY` it prints in your secret store. It shows once.
3. Install the SDK.

TypeScript:

```bash
npm install mailset
```

Python:

```bash
pip install mailset
```

Go:

```bash
go get mailset.app/go
```

Ruby:

```bash
gem install mailset
```

PHP:

```bash
composer require mailset-app/php
```

Java:

```kotlin
implementation("app.mailset:java:0.7.0")
```

Rust:

```bash
cargo add mailset
```

4. Send.

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const sent = await mailset.send({
	from: 'Acme <hello@example.com>',
	to: 'ana@example.org',
	subject: 'Your Acme code',
	text: 'Your code is 123456.',
	html: '<p>Your code is <b>123456</b>.</p>',
	deliverBy: '10m',
});

console.log(sent.id, sent.status);
```

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

sent = mailset.send(
    {
        "from": "Acme <hello@example.com>",
        "to": "ana@example.org",
        "subject": "Your Acme code",
        "text": "Your code is 123456.",
        "html": "<p>Your code is <b>123456</b>.</p>",
        "deliver_by": "10m",
    }
)

print(sent["id"], sent["status"])
```

```go
import (
	"context"
	"fmt"
	"log"
	"time"

	mailset "mailset.app/go"
)

client, err := mailset.NewClient() // reads MAILSET_KEY
if err != nil {
	log.Fatal(err)
}
ctx := context.Background()

sent, err := client.Send(ctx, mailset.Message{
	From:      "Acme <hello@example.com>",
	To:        []string{"ana@example.org"},
	Subject:   "Your Acme code",
	Text:      "Your code is 123456.",
	HTML:      "<p>Your code is <b>123456</b>.</p>",
	DeliverBy: mailset.Within(10 * time.Minute),
})
if err != nil {
	log.Fatal(err)
}

fmt.Println(sent.ID, sent.Status)
```

```ruby
require 'mailset'

mailset = Mailset::Client.new

sent = mailset.send_email(
  from: 'Acme <hello@example.com>',
  to: 'ana@example.org',
  subject: 'Your Acme code',
  text: 'Your code is 123456.',
  html: '<p>Your code is <b>123456</b>.</p>',
  deliver_by: '10m'
)

puts sent.id, sent.status
```

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$sent = $mailset->send([
    'from' => 'Acme <hello@example.com>',
    'to' => 'ana@example.org',
    'subject' => 'Your Acme code',
    'text' => 'Your code is 123456.',
    'html' => '<p>Your code is <b>123456</b>.</p>',
    'deliverBy' => '10m',
]);

echo $sent->id, ' ', $sent->status, PHP_EOL;
```

```java
import app.mailset.Mailset;
import app.mailset.Message;
import app.mailset.Sent;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

Sent sent = mailset.send(Message.builder()
        .from("Acme <hello@example.com>")
        .to("ana@example.org")
        .subject("Your Acme code")
        .text("Your code is 123456.")
        .html("<p>Your code is <b>123456</b>.</p>")
        .deliverBy("10m")
        .build());

System.out.println(sent.id() + " " + sent.status());
```

```rust
use mailset::{Client, Message};

// Reads MAILSET_KEY from the environment.
let mailset = Client::from_env()?;

let message = Message::builder()
    .from("Acme <hello@example.com>")
    .to("ana@example.org")
    .subject("Your Acme code")
    .text("Your code is 123456.")
    .html("<p>Your code is <b>123456</b>.</p>")
    .deliver_by("10m");
let sent = mailset.send(message).await?;

println!("{} {:?}", sent.id, sent.status);
```

From a terminal, `mailset messages submit --file code.eml --transactional` sends a message you have as a file.

Without an SDK, you build the message and sign the request yourself: [Send your own MIME](https://mailset.app/docs/recipes/mime) has the code in each language.

No domain on Mailset yet? `mailset guide onboarding` sets one up, and the same steps are at [mailset.app/guide/onboarding](https://mailset.app/guide/onboarding).

## What to read next

- [Authentication](https://mailset.app/docs/authentication): make a key, give it to the SDK, and keep it alive.
- [API reference](https://mailset.app/docs/api): every command as an HTTP request. It is also one file, [openapi.json](https://mailset.app/openapi.json).
- [CLI reference](https://mailset.app/docs/cli): every `mailset` command with its flags.
- [Webhooks](https://mailset.app/docs/webhooks): delivered, bounced, complained, unsubscribed and the rest, posted to your server.
- [Recipes](https://mailset.app/docs/recipes/sending-only): a domain whose mail stays elsewhere, unsubscribes, bounces, deadlines for codes, batches, retries.
- [Errors and limits](https://mailset.app/docs/errors): every error code, and what a sending limit does.

## For agents

Every page here has a Markdown twin at its address plus `.md`, and [llms.txt](https://mailset.app/llms.txt) lists them all. An agent with a terminal can skip the docs: `mailset --help` lists every command, and `mailset guide` prints the setup recipes.

---

© 2026 Intenseloop, Inc. Mailset’s site, docs and guides are copyrighted. You may read them and use their code to build with Mailset. Don’t republish them or use them to build a copy of Mailset. Terms: https://mailset.app/terms#content