Messages

Messages

Send email: whole messages from your product, or a person’s own.

An SDK signs every request with your key: Authentication. To sign one yourself, see Calling the API without an SDK.

On this page
  1. The Receipt object
  2. messages.send
  3. messages.markUnread
  4. messages.original
  5. messages.star
  6. messages.delete
  7. messages.report
  8. messages.unsubscribe
  9. messages.submit
  10. messages.submitMany
  11. messages.cancel
  12. messages.sendNow
  13. messages.scheduled

The Receipt object

What a send answers: the message’s id, whether it went or waits, and who was left out.

Attributes

  • idstring

    Mailset’s id for this send.

  • messageIdstringoptional

    The id its message will have in the conversation once it goes.

  • sendAtnumber

    When it goes out, in milliseconds since 1970: the time asked, or later when a limit holds it.

  • heldstringoptional

    Why it waits past the time asked: a sending limit that clears by waiting.

  • raisablebooleanoptional

    True when what holds it is one of the plan’s sending limits, which Mailset support can raise.

  • stateenum

    sent: it went, or every recipient was skipped and nothing is left to do. queued: Mailset holds it and sends it at sendAt.

    One ofsentqueued

  • skippedarray of objectsoptional

    Recipients Mailset left out. They never get it, the others do, and there is nothing to retry. Absent when nobody was skipped.

    Show child attributesHide child attributes
    • addressstring

      The address that was left out.

    • reasonenum

      private_relay: an Apple Hide My Email address. disposable: a temporary inbox. unsubscribed: it unsubscribed from this mailbox’s promotional mail.

      One ofprivate_relaydisposableunsubscribed

Answered by

messages.submitmessages.sendNow

The Receipt object
{
  "id": "out_3f9a1c0e7b2d",
  "messageId": "moc.elpmaxe@85a4d2b7e0c1a9f3",
  "sendAt": 1796048940000,
  "state": "sent"
}

messages.send

Send mail from one of your addresses. A reply (threadId) carries the message it answers under your text, as Gmail quotes it; quote false sends it bare.

POST/v1/messages.send

API token

Parameters

  • fromstringrequired

    One of your addresses.

  • toarray of stringsoptional

    Who it goes to, up to 100 addresses.

    Default []. At most 100 items.

  • ccarray of stringsoptional

    Who gets a copy, up to 100 addresses.

    Default []. At most 100 items.

  • bccarray of stringsoptional

    Who gets a copy the others don’t see, up to 100 addresses.

    Default []. At most 100 items.

  • subjectstringoptional

    The subject, on one line.

    At most 998 characters.

  • textstringrequired

    The message’s text.

    At most 5,000,000 characters.

  • threadIdstringoptional

    Answering this conversation.

  • delaySecondsintegeroptional

    Seconds to hold it so it can be taken back, 0 to 120.

    Default 0. From 0 to 120.

  • sendAtintegeroptional

    Scheduled send: when, in ms since the epoch.

  • draftIdstringoptional

    The draft this came from. It goes once the mail has.

  • markdownbooleanoptional

    text has bold, italic, lists, quotes or links to send as formatting.

    Default false.

  • quotebooleanoptional

    A reply carries the message it answers under the new text, added here at send time. False sends the new text alone.

    Default true.

  • answeringstringoptional

    The conversation’s message this answers, for that quote: the newest that arrived unless given.

Returns

data is an object with:

  • idstring

    Mailset’s id for this send.

  • messageIdstringoptional

    The id its message will have in the conversation once it goes.

  • sendAtnumber

    When it goes out, in milliseconds since 1970: the time asked, or later when a limit holds it.

  • heldstringoptional

    Why it waits past the time asked: a sending limit that clears by waiting.

  • raisablebooleanoptional

    True when what holds it is one of the plan’s sending limits, which Mailset support can raise.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.send({
	from: "moc.elpmaxe@ana",
	to: [
		"moc.elpmaxe@airam",
	],
	subject: "Quote for March",
	text: "Hi Maria, the quote is attached.",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.send(
    {
        "from": "moc.elpmaxe@ana",
        "to": ["moc.elpmaxe@airam"],
        "subject": "Quote for March",
        "text": "Hi Maria, the quote is attached.",
    }
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesSendParams{
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.send_message(
  from: 'moc.elpmaxe@ana',
  to: ['moc.elpmaxe@airam'],
  subject: 'Quote for March',
  text: 'Hi Maria, the quote is attached.'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->send([
    'from' => 'moc.elpmaxe@ana',
    'to' => ['moc.elpmaxe@airam'],
    'subject' => 'Quote for March',
    'text' => 'Hi Maria, the quote is attached.',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesSendParams;
import app.mailset.model.SendReceipt;
import java.util.List;

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

var params = MessagesSendParams.builder()
        .from("moc.elpmaxe@ana")
        .to(List.of("moc.elpmaxe@airam"))
        .subject("Quote for March")
        .text("Hi Maria, the quote is attached.")
        .build();
SendReceipt answer = mailset.messages().send(params);
System.out.println(answer);
use mailset::types::MessagesSendParams;

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

let answer = mailset
    .messages()
    .send(MessagesSendParams {
        from: "moc.elpmaxe@ana".into(),
        to: Some(vec!["moc.elpmaxe@airam".into()]),
        subject: Some("Quote for March".into()),
        text: "Hi Maria, the quote is attached.".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.send \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"from":"moc.elpmaxe@ana","to":["moc.elpmaxe@airam"],"subject":"Quote for March","text":"Hi Maria, the quote is attached."}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages send --from moc.elpmaxe@ana --to moc.elpmaxe@airam --subject "Quote for March" --text "Hi Maria, the quote is attached."
Response
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "messageId": "moc.elpmaxe@85a4d2b7e0c1a9f3",
    "sendAt": 1796048940000,
    "held": "The day’s sending limit is reached.",
    "raisable": true
  }
}

messages.markUnread

Mark a conversation unread from this message on.

POST/v1/messages.markUnread

API token

Parameters

  • idstringrequired

    The message’s id, from threads get.

Returns

data is an object with:

  • threadIdstring

    The conversation it’s in.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.markUnread({
	id: "msg_91b7e4c2a6f03d58b1c4e7a9",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.mark_unread(
    {"id": "msg_91b7e4c2a6f03d58b1c4e7a9"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesMarkUnreadParams{
		ID: "msg_91b7e4c2a6f03d58b1c4e7a9",
	}
	answer, err := client.Messages.MarkUnread(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.mark_unread(
  id: 'msg_91b7e4c2a6f03d58b1c4e7a9'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->markUnread([
    'id' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesMarkUnreadParams;
import app.mailset.model.MessagesMarkUnreadResult;

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

var params = MessagesMarkUnreadParams.builder()
        .id("msg_91b7e4c2a6f03d58b1c4e7a9")
        .build();
MessagesMarkUnreadResult answer =
        mailset.messages().markUnread(params);
System.out.println(answer);
use mailset::types::MessagesMarkUnreadParams;

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

let answer = mailset
    .messages()
    .mark_unread(MessagesMarkUnreadParams {
        id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.markUnread \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"msg_91b7e4c2a6f03d58b1c4e7a9"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages markUnread msg_91b7e4c2a6f03d58b1c4e7a9
Response
{
  "ok": true,
  "data": {
    "threadId": "out_3f9a1c0e7b2d"
  }
}

messages.original

Get a message as it arrived, as an .eml file.

POST/v1/messages.original

API token

Parameters

  • idstringrequired

    The message’s id, from threads get.

Returns

data is an object with:

  • namestring

    A file name for it, ending in .eml.

  • datastring

    The raw message, base64.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.original({
	id: "msg_91b7e4c2a6f03d58b1c4e7a9",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.original(
    {"id": "msg_91b7e4c2a6f03d58b1c4e7a9"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesOriginalParams{
		ID: "msg_91b7e4c2a6f03d58b1c4e7a9",
	}
	answer, err := client.Messages.Original(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.original(
  id: 'msg_91b7e4c2a6f03d58b1c4e7a9'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->original([
    'id' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesOriginalParams;
import app.mailset.model.MessagesOriginalResult;

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

var params = MessagesOriginalParams.builder()
        .id("msg_91b7e4c2a6f03d58b1c4e7a9")
        .build();
MessagesOriginalResult answer =
        mailset.messages().original(params);
System.out.println(answer);
use mailset::types::MessagesOriginalParams;

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

let answer = mailset
    .messages()
    .original(MessagesOriginalParams {
        id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.original \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"msg_91b7e4c2a6f03d58b1c4e7a9"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages original msg_91b7e4c2a6f03d58b1c4e7a9
Response
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "data": "<base64>"
  }
}

messages.star

Star one message, or take its star off.

POST/v1/messages.star

API token

Parameters

  • idstringrequired

    The message’s id, from threads get.

  • starredbooleanoptional

    True to star it, false to take the star off.

    Default true.

Returns

data is an object with:

  • threadIdstring

    The conversation it’s in.

  • starredboolean

    Whether the conversation is still starred.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.star({
	id: "msg_91b7e4c2a6f03d58b1c4e7a9",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.star(
    {"id": "msg_91b7e4c2a6f03d58b1c4e7a9"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesStarParams{
		ID: "msg_91b7e4c2a6f03d58b1c4e7a9",
	}
	answer, err := client.Messages.Star(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.star(
  id: 'msg_91b7e4c2a6f03d58b1c4e7a9'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->star([
    'id' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesStarParams;
import app.mailset.model.MessagesStarResult;

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

var params = MessagesStarParams.builder()
        .id("msg_91b7e4c2a6f03d58b1c4e7a9")
        .build();
MessagesStarResult answer =
        mailset.messages().star(params);
System.out.println(answer);
use mailset::types::MessagesStarParams;

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

let answer = mailset
    .messages()
    .star(MessagesStarParams {
        id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.star \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"msg_91b7e4c2a6f03d58b1c4e7a9"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages star msg_91b7e4c2a6f03d58b1c4e7a9
Response
{
  "ok": true,
  "data": {
    "threadId": "out_3f9a1c0e7b2d",
    "starred": true
  }
}

messages.delete

Delete one message for good, with its files.

POST/v1/messages.delete

API tokenPasskey

Parameters

  • idstringrequired

    The message’s id, from threads get.

Beside input

  • approvalstringoptional

    An approval’s id, once someone approved it with their passkey. Without one, the answer is step_up_required and names what to approve.

Returns

data is an object with:

  • threadIdstring

    The conversation it was in.

  • threadRemovedboolean

    True when it was the conversation’s last message, so the conversation went too.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.delete({
	id: "msg_91b7e4c2a6f03d58b1c4e7a9",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.delete(
    {"id": "msg_91b7e4c2a6f03d58b1c4e7a9"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesDeleteParams{
		ID: "msg_91b7e4c2a6f03d58b1c4e7a9",
	}
	answer, err := client.Messages.Delete(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.delete(
  id: 'msg_91b7e4c2a6f03d58b1c4e7a9'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->delete([
    'id' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesDeleteParams;
import app.mailset.model.MessagesDeleteResult;

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

var params = MessagesDeleteParams.builder()
        .id("msg_91b7e4c2a6f03d58b1c4e7a9")
        .build();
MessagesDeleteResult answer =
        mailset.messages().delete(params);
System.out.println(answer);
use mailset::types::MessagesDeleteParams;

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

let answer = mailset
    .messages()
    .delete(MessagesDeleteParams {
        id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.delete \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"msg_91b7e4c2a6f03d58b1c4e7a9"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages delete msg_91b7e4c2a6f03d58b1c4e7a9
Response
{
  "ok": true,
  "data": {
    "threadId": "out_3f9a1c0e7b2d",
    "threadRemoved": true
  }
}

messages.report

Report one message as junk or phishing, and move it to Junk.

POST/v1/messages.report

API token

Parameters

  • idstringrequired

    The message’s id, from threads get.

  • kindenumoptional

    junk or phishing.

    One ofjunkphishing

    Default junk.

Returns

data is an object with:

  • threadIdstring

    The conversation it’s in.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.report({
	kind: "phishing",
	id: "msg_91b7e4c2a6f03d58b1c4e7a9",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.report(
    {
        "kind": "phishing",
        "id": "msg_91b7e4c2a6f03d58b1c4e7a9",
    }
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesReportParams{
		Kind: mailset.ReportKindPhishing,
		ID:   "msg_91b7e4c2a6f03d58b1c4e7a9",
	}
	answer, err := client.Messages.Report(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.report(
  kind: 'phishing',
  id: 'msg_91b7e4c2a6f03d58b1c4e7a9'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->report([
    'kind' => 'phishing',
    'id' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesReportParams;
import app.mailset.model.MessagesReportResult;
import app.mailset.model.ReportKind;

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

var params = MessagesReportParams.builder()
        .kind(ReportKind.PHISHING)
        .id("msg_91b7e4c2a6f03d58b1c4e7a9")
        .build();
MessagesReportResult answer =
        mailset.messages().report(params);
System.out.println(answer);
use mailset::types::{MessagesReportParams, ReportKind};

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

let answer = mailset
    .messages()
    .report(MessagesReportParams {
        id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
        kind: Some(ReportKind::Phishing),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.report \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"kind":"phishing","id":"msg_91b7e4c2a6f03d58b1c4e7a9"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages report msg_91b7e4c2a6f03d58b1c4e7a9 --kind phishing
Response
{
  "ok": true,
  "data": {
    "threadId": "out_3f9a1c0e7b2d"
  }
}

messages.unsubscribe

Unsubscribe from whoever sent a message: asked for you, or their page to open.

POST/v1/messages.unsubscribe

API token

Parameters

  • idstringrequired

    The message’s id, from threads get.

Returns

data is an object with:

  • stateenum

    One ofsentfailedlinknone

  • urlstringoptional

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.unsubscribe({
	id: "msg_91b7e4c2a6f03d58b1c4e7a9",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.unsubscribe(
    {"id": "msg_91b7e4c2a6f03d58b1c4e7a9"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesUnsubscribeParams{
		ID: "msg_91b7e4c2a6f03d58b1c4e7a9",
	}
	answer, err := client.Messages.Unsubscribe(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.unsubscribe(
  id: 'msg_91b7e4c2a6f03d58b1c4e7a9'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->unsubscribe([
    'id' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesUnsubscribeParams;
import app.mailset.model.UnsubscribeResult;

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

var params = MessagesUnsubscribeParams.builder()
        .id("msg_91b7e4c2a6f03d58b1c4e7a9")
        .build();
UnsubscribeResult answer =
        mailset.messages().unsubscribe(params);
System.out.println(answer);
use mailset::types::MessagesUnsubscribeParams;

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

let answer = mailset
    .messages()
    .unsubscribe(MessagesUnsubscribeParams {
        id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.unsubscribe \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"msg_91b7e4c2a6f03d58b1c4e7a9"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages unsubscribe msg_91b7e4c2a6f03d58b1c4e7a9
Response
{
  "ok": true,
  "data": {
    "state": "sent",
    "url": "https://hooks.example.com/mailset"
  }
}

messages.submit

Send a whole RFC 5322 message as written.

POST/v1/messages.submit

App key with sendAPI token

Parameters

  • datastringrequired

    The whole RFC 5322 message, in base64, up to 20 MB.

  • transactionalbooleanoptional

    A product’s own mail: no copy in Sent, nobody added to contacts, and only the delivery log remembers it.

    Default false.

  • modeenumoptional

    The kind of product mail. transactional: a code or a receipt, which can’t carry List-Unsubscribe or Precedence: bulk. promotional: a newsletter or an offer, to one address in To; with no List-Unsubscribe of its own, Mailset adds a one-click one and puts the link at {{mailset_unsubscribe}} in the body, or on a last line.

    One oftransactionalpromotional

  • deliverByintegeroptional

    The latest it may go out, in milliseconds since 1970. Held past it at submit, it is refused with retryAt; still waiting when it comes, it is dropped unsent.

The body may be up to 28 MB.

Returns

data is the Receipt object.

In the CLIErrors

import { Mailset } from 'mailset';

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

const sent = await mailset.send({
	from: 'Acme <moc.elpmaxe@olleh>',
	to: 'gro.elpmaxe@ana',
	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);
from mailset import Mailset

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

sent = mailset.send(
    {
        "from": "Acme <moc.elpmaxe@olleh>",
        "to": "gro.elpmaxe@ana",
        "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"])
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 <moc.elpmaxe@olleh>",
	To:        []string{"gro.elpmaxe@ana"},
require 'mailset'

mailset = Mailset::Client.new

sent = mailset.send_email(
  from: 'Acme <moc.elpmaxe@olleh>',
  to: 'gro.elpmaxe@ana',
  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

require 'vendor/autoload.php';

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

$sent = $mailset->send([
    'from' => 'Acme <moc.elpmaxe@olleh>',
    'to' => 'gro.elpmaxe@ana',
    '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;
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 <moc.elpmaxe@olleh>")
        .to("gro.elpmaxe@ana")
        .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());
use mailset::{Client, Message};

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

let message = Message::builder()
    .from("Acme <moc.elpmaxe@olleh>")
    .to("gro.elpmaxe@ana")
    .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);
curl https://mailset.app/v1/messages.submit \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"transactional":true,"name":"receipt.eml","data":"<the message as base64>"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how. <the message as base64> is a whole email, headers and body: Send your own MIME.

mailset messages submit --file receipt.eml --transactional
Response
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "sendAt": 1796048940000,
    "state": "sent"
  }
}

messages.submitMany

Send up to 100 whole messages, each with its own answer.

POST/v1/messages.submitMany

App key with sendAPI token

Parameters

  • messagesarray of objectsrequired

    The messages, 1 to 100, each as messages submit takes one. 48 MB together, before base64.

    1 to 100 items.

    Show child attributesHide child attributes
    • datastringrequired

      The whole RFC 5322 message, in base64, up to 20 MB.

    • transactionalbooleanoptional

      A product’s own mail: no copy in Sent, nobody added to contacts, and only the delivery log remembers it.

      Default false.

    • modeenumoptional

      The kind of product mail. transactional: a code or a receipt, which can’t carry List-Unsubscribe or Precedence: bulk. promotional: a newsletter or an offer, to one address in To; with no List-Unsubscribe of its own, Mailset adds a one-click one and puts the link at {{mailset_unsubscribe}} in the body, or on a last line.

      One oftransactionalpromotional

    • deliverByintegeroptional

      The latest it may go out, in milliseconds since 1970. Held past it at submit, it is refused with retryAt; still waiting when it comes, it is dropped unsent.

The body may be up to 67 MB.

Returns

data is an object with:

  • resultsarray of objects

    One answer per message, in the order they came: ok: true with its receipt, or ok: false with the refusal.

    Show child attributesHide child attributes
    • idstringoptional

      Mailset’s id for this send.

    • messageIdstringoptional

      The id its message will have in the conversation once it goes.

    • sendAtnumberoptional

      When it goes out, in milliseconds since 1970: the time asked, or later when a limit holds it.

    • heldstringoptional

      Why it waits past the time asked: a sending limit that clears by waiting.

    • raisablebooleanoptional

      True when what holds it is one of the plan’s sending limits, which Mailset support can raise.

    • stateenumoptional

      sent: it went, or every recipient was skipped and nothing is left to do. queued: Mailset holds it and sends it at sendAt.

      One ofsentqueued

    • skippedarray of objectsoptional

      Recipients Mailset left out. They never get it, the others do, and there is nothing to retry. Absent when nobody was skipped.

      Show child attributesHide child attributes
      • addressstring

        The address that was left out.

      • reasonenum

        private_relay: an Apple Hide My Email address. disposable: a temporary inbox. unsubscribed: it unsubscribed from this mailbox’s promotional mail.

        One ofprivate_relaydisposableunsubscribed

    • okboolean

      Mailset took this message.

    • errorobjectoptional

      Why, as any refused call says it: a stable code and a message for people.

      Show child attributesHide child attributes
      • codeenum

        What kind of refusal it is. The HTTP status follows from it.

        One ofinvalid_inputunauthorizedstep_up_requiredforbiddennot_foundconflictexpiredlimit_reachedunavailableinternal

      • messagestring

        The refusal in words, fit to show a person.

      • issuesarray of objectsoptional

        On invalid_input: each field that was wrong.

        Show child attributesHide child attributes
        • patharray of strings or numbers

          Which input field is wrong: its name, then any keys inside it.

        • messagestring

          What’s wrong with it, in words.

      • purposeobjectoptional

        On step_up_required: the action a passkey has to approve.

        Show child attributesHide child attributes
        • kindenum

          What the action is about: a domain, a mailbox, a member and so on.

          One ofdevicememberpasskeydomainmailboxtokenapprovalruleforwardmessagegrouppolicyexportaccountrecoverypaperkeydnsgoogleai

        • idstring

          The action itself, as text a passkey check is made for.

        • orgnullable string

          The org it’s in. Null for an action on your own account.

      • refusalenumoptional

        When mail was refused: why, as a short code.

        One ofdomain_pendingdomain_blockedprovider_refusedrecipientmail_domainseat_charge

      • retryAtnumberoptional

        On limit_reached for mail with a deadline: the soonest it could go, in ms since the epoch. Send it again then, or with a later deadline.

      • docsstringoptional

        When a sending limit refused it: the page that lists every plan’s limits, as a URL.

      • supportstringoptional

        When Mailset support can raise the limit that refused it: where to ask, as a URL.

      • revokedbooleanoptional

        On unauthorized: this device was signed out for good, not just out of time.

      • suggestionstringoptional

        On a refused address: the one it likely meant, for the person to pick or ignore.

In the CLIErrors

import { Mailset } from 'mailset';

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

const results = await mailset.send([
	{
		from: 'Acme <moc.elpmaxe@olleh>',
		to: 'gro.elpmaxe@ana',
		subject: 'Your invoice',
		text: 'Invoice 8842 is ready.',
	},
	{
		from: 'Acme <moc.elpmaxe@olleh>',
		to: 'gro.elpmaxe@neb',
		subject: 'Your invoice',
		text: 'Invoice 8843 is ready.',
	},
]);

for (const result of results) {
	if (result.ok) console.log(result.id, result.status);
	else console.error(result.messageId, result.error.code);
}
from mailset import Mailset

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

results = mailset.send(
    [
        {
            "from": "Acme <moc.elpmaxe@olleh>",
            "to": "gro.elpmaxe@ana",
            "subject": "Your invoice",
            "text": "Invoice 8842 is ready.",
        },
        {
            "from": "Acme <moc.elpmaxe@olleh>",
            "to": "gro.elpmaxe@neb",
            "subject": "Your invoice",
            "text": "Invoice 8843 is ready.",
        },
    ]
)

for result in results:
    if result["ok"]:
        print(result["id"], result["status"])
    else:
        print(result["message_id"], result["error"].code)
import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

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

results, err := client.SendMany(ctx, []mailset.Message{
	{
		From:    "Acme <moc.elpmaxe@olleh>",
		To:      []string{"gro.elpmaxe@ana"},
require 'mailset'

mailset = Mailset::Client.new

results = mailset.send_emails([
  {
    from: 'Acme <moc.elpmaxe@olleh>',
    to: 'gro.elpmaxe@ana',
    subject: 'Your invoice',
    text: 'Invoice 8842 is ready.'
  },
  {
    from: 'Acme <moc.elpmaxe@olleh>',
    to: 'gro.elpmaxe@neb',
    subject: 'Your invoice',
    text: 'Invoice 8843 is ready.'
  }
])

results.each do |result|
  if result.ok?
    puts "#{result.id} #{result.status}"
  else
    warn "#{result.message_id} #{result.error.code}"
  end
end
<?php

require 'vendor/autoload.php';

use Mailset\Sent;

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

$results = $mailset->sendMany([
    [
        'from' => 'Acme <moc.elpmaxe@olleh>',
        'to' => 'gro.elpmaxe@ana',
        'subject' => 'Your invoice',
        'text' => 'Invoice 8842 is ready.',
    ],
    [
        'from' => 'Acme <moc.elpmaxe@olleh>',
import app.mailset.Mailset;
import app.mailset.Message;
import app.mailset.NotSent;
import app.mailset.SendResult;
import app.mailset.Sent;
import java.util.List;

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

List<SendResult> results = mailset.send(List.of(
        Message.builder()
                .from("Acme <moc.elpmaxe@olleh>")
                .to("gro.elpmaxe@ana")
                .subject("Your invoice")
                .text("Invoice 8842 is ready.")
                .build(),
        Message.builder()
use mailset::{Client, Message};

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

let invoice = |to: &str, number: u32| {
    Message::builder()
        .from("Acme <moc.elpmaxe@olleh>")
        .to(to)
        .subject("Your invoice")
        .text(format!("Invoice {number} is ready."))
};
let messages = [
    invoice("gro.elpmaxe@ana", 8842),
    invoice("gro.elpmaxe@neb", 8843),
];
let results = mailset.send_many(messages).await?;

for result in results {
    match result {
        Ok(sent) => println!("{}", sent.id),
        Err(not) => eprintln!("{}", not.error),
    }
}
curl https://mailset.app/v1/messages.submitMany \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"messages":[{"data":"<the message as base64>","transactional":true}]}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how. <the message as base64> is a whole email, headers and body: Send your own MIME.

mailset messages submitMany --messages @messages.json
messages.json
[
  {
    "data": "<the message as base64>",
    "transactional": true
  }
]

<the message as base64> is a whole email, headers and body: Send your own MIME.

Response
{
  "ok": true,
  "data": {
    "results": [
      {
        "ok": true,
        "id": "out_3f9a1c0e7b2d",
        "sendAt": 1796048940000,
        "state": "sent"
      },
      {
        "ok": true,
        "id": "out_8d2k4m1p9q7x",
        "sendAt": 1796048940000,
        "state": "sent",
        "skipped": [
          {
            "address": "moc.dielppa.yaleretavirp@m4dq9p2k7x",
            "reason": "private_relay"
          }
        ]
      }
    ]
  }
}

messages.cancel

Take back a message that hasn’t gone yet.

POST/v1/messages.cancel

API token

Parameters

  • idstringrequired

    The waiting message’s id, from messages send or messages scheduled.

Returns

data is an object with:

  • cancelledboolean

    True when it was still waiting and won’t go.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.cancel({
	id: "out_2e8b6d1f4a9c3075d6b1e8a4",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.cancel(
    {"id": "out_2e8b6d1f4a9c3075d6b1e8a4"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesCancelParams{
		ID: "out_2e8b6d1f4a9c3075d6b1e8a4",
	}
	answer, err := client.Messages.Cancel(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.cancel(
  id: 'out_2e8b6d1f4a9c3075d6b1e8a4'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->cancel([
    'id' => 'out_2e8b6d1f4a9c3075d6b1e8a4',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesCancelParams;
import app.mailset.model.MessagesCancelResult;

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

var params = MessagesCancelParams.builder()
        .id("out_2e8b6d1f4a9c3075d6b1e8a4")
        .build();
MessagesCancelResult answer =
        mailset.messages().cancel(params);
System.out.println(answer);
use mailset::types::MessagesCancelParams;

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

let answer = mailset
    .messages()
    .cancel(MessagesCancelParams {
        id: "out_2e8b6d1f4a9c3075d6b1e8a4".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.cancel \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"out_2e8b6d1f4a9c3075d6b1e8a4"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages cancel out_2e8b6d1f4a9c3075d6b1e8a4
Response
{
  "ok": true,
  "data": {
    "cancelled": true
  }
}

messages.sendNow

Send a message held for Undo now, without waiting out its time.

POST/v1/messages.sendNow

API token

Parameters

  • idstringrequired

    The waiting message’s id, from messages send.

Returns

data is the Receipt object.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.sendNow({
	id: "out_2e8b6d1f4a9c3075d6b1e8a4",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.send_now(
    {"id": "out_2e8b6d1f4a9c3075d6b1e8a4"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.MessagesSendNowParams{
		ID: "out_2e8b6d1f4a9c3075d6b1e8a4",
	}
	answer, err := client.Messages.SendNow(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.send_now(
  id: 'out_2e8b6d1f4a9c3075d6b1e8a4'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->sendNow([
    'id' => 'out_2e8b6d1f4a9c3075d6b1e8a4',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.MessagesSendNowParams;
import app.mailset.model.Receipt;

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

var params = MessagesSendNowParams.builder()
        .id("out_2e8b6d1f4a9c3075d6b1e8a4")
        .build();
Receipt answer = mailset.messages().sendNow(params);
System.out.println(answer);
use mailset::types::MessagesSendNowParams;

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

let answer = mailset
    .messages()
    .send_now(MessagesSendNowParams {
        id: "out_2e8b6d1f4a9c3075d6b1e8a4".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.sendNow \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"out_2e8b6d1f4a9c3075d6b1e8a4"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages sendNow out_2e8b6d1f4a9c3075d6b1e8a4
Response
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "messageId": "moc.elpmaxe@85a4d2b7e0c1a9f3",
    "sendAt": 1796048940000,
    "state": "sent"
  }
}

messages.scheduled

List mail waiting for its time.

POST/v1/messages.scheduled

API token

Parameters

It takes no input: send an empty object.

Returns

data is a list of objects, each with:

  • idstring

    The id to cancel it or send it now by.

  • mailboxstring

    The mailbox it goes out from.

  • fromstring

    Its From address.

  • toarray of strings

    Who it goes to.

  • subjectstring

    Its subject.

  • snippetstring

    The start of its text.

  • sendAtnumber

    When it goes out, in milliseconds since 1970.

  • hasDraftboolean

    Cancelling puts it back in Drafts.

  • heldstringoptional

    Why it hasn’t gone yet when its time has come, such as a sending limit. It goes out at sendAt.

  • raisablebooleanoptional

    True when what holds it is one of the plan’s sending limits, which Mailset support can raise.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.messages.scheduled();
console.log(answer);
from mailset import Mailset

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

answer = mailset.messages.scheduled()
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Messages.Scheduled(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.messages.scheduled
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->messages->scheduled();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Scheduled;
import java.util.List;

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

List<Scheduled> answer = mailset.messages().scheduled();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.messages().scheduled().await?;
println!("{answer:?}");
curl https://mailset.app/v1/messages.scheduled \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset messages scheduled
Response
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "mailbox": "text",
      "from": "moc.elpmaxe@olleh",
      "to": [
        "moc.elpmaxe@ana"
      ],
      "subject": "Your Acme receipt",
      "snippet": "text",
      "sendAt": 1796048940000,
      "hasDraft": true,
      "held": "The day’s sending limit is reached.",
      "raisable": true
    }
  ]
}