Forwarding

Forwarding

Send a mailbox’s new email on to another address.

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 Forward object
  2. forwarding.list
  3. forwarding.set
  4. forwarding.remove
  5. forwarding.resend

The Forward object

Where a mailbox’s email is forwarded, and how that stands.

Attributes

  • mailboxstring
  • destinationnullable string
  • stateenum

    One ofnonependingactivefailingheldblocked

  • notenullable string

    What this state means for this mailbox, in words.

  • failuresnumber

    Forwards that failed since one last went through.

  • policyenum

    never wins if anyone in the mailbox, or any org admin or owner, chose it.

    One ofpasskeynever

  • manageableboolean

    Admins and owners add and change it. Everyone in the mailbox can read it.

  • routeboolean

    The destination is one of the org’s own inbound routes (a product’s hook).

  • sentboolean

    What the mailbox sends goes there too. Only a route takes it.

Answered by

forwarding.listforwarding.setforwarding.resend

The Forward object
{
  "mailbox": "text",
  "destination": "text",
  "state": "none",
  "note": "text",
  "failures": 1,
  "policy": "passkey",
  "manageable": true,
  "route": true,
  "sent": true
}

forwarding.list

Show where each of your mailboxes forwards.

POST/v1/forwarding.list

API token

Parameters

It takes no input: send an empty object.

Returns

data is a list of Forward objects.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.forwarding.list();
console.log(answer);
from mailset import Mailset

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

answer = mailset.forwarding.list()
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.Forwarding.List(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

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

answer = mailset.forwarding.list
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->forwarding->list();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Forward;
import java.util.List;

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

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

let answer = mailset.forwarding().list().await?;
println!("{answer:?}");
curl https://mailset.app/v1/forwarding.list \
  -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 forwarding list
Response
{
  "ok": true,
  "data": [
    {
      "mailbox": "text",
      "destination": "text",
      "state": "none",
      "note": "text",
      "failures": 1,
      "policy": "passkey",
      "manageable": true,
      "route": true,
      "sent": true
    }
  ]
}

forwarding.set

Forward a mailbox’s new mail to an outside address, once that address confirms (one of your inbound routes needs no confirming).

POST/v1/forwarding.set

Admin or ownerPasskey

Parameters

  • mailboxstringrequired

    The mailbox’s address.

  • tostringrequired

    Where its new mail goes: an outside address, or one of your inbound routes.

  • sentbooleanoptional

    Also what the mailbox sends. Only for one of your inbound routes. Left out: as it is.

Beside input

  • orgstringoptional

    The org this is about. Needed when the caller is in more than one.

  • 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 the Forward object.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.forwarding.set({
	to: "gro.elpmaxe@ana",
	mailbox: "moc.elpmaxe@ana",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.forwarding.set(
    {
        "to": "gro.elpmaxe@ana",
        "mailbox": "moc.elpmaxe@ana",
    }
)
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.ForwardingSetParams{
		To:      "gro.elpmaxe@ana",
		Mailbox: "moc.elpmaxe@ana",
	}
	answer, err := client.Forwarding.Set(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.forwarding.set(
  to: 'gro.elpmaxe@ana',
  mailbox: 'moc.elpmaxe@ana'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->forwarding->set([
    'to' => 'gro.elpmaxe@ana',
    'mailbox' => 'moc.elpmaxe@ana',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Forward;
import app.mailset.model.ForwardingSetParams;

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

var params = ForwardingSetParams.builder()
        .to("gro.elpmaxe@ana")
        .mailbox("moc.elpmaxe@ana")
        .build();
Forward answer = mailset.forwarding().set(params);
System.out.println(answer);
use mailset::types::ForwardingSetParams;

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

let answer = mailset
    .forwarding()
    .set(ForwardingSetParams {
        mailbox: "moc.elpmaxe@ana".into(),
        to: "gro.elpmaxe@ana".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/forwarding.set \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"to":"gro.elpmaxe@ana","mailbox":"moc.elpmaxe@ana"},"org":"org_3f9a1c0e7b2d"}'

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 forwarding set moc.elpmaxe@ana --to gro.elpmaxe@ana
Response
{
  "ok": true,
  "data": {
    "mailbox": "text",
    "destination": "text",
    "state": "none",
    "note": "text",
    "failures": 1,
    "policy": "passkey",
    "manageable": true,
    "route": true,
    "sent": true
  }
}

forwarding.remove

Stop forwarding a mailbox.

POST/v1/forwarding.remove

Admin or owner

Parameters

  • mailboxstringrequired

    The mailbox’s address.

Beside input

  • orgstringoptional

    The org this is about. Needed when the caller is in more than one.

Returns

data is an object with:

  • removedboolean

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.forwarding.remove({
	mailbox: "moc.elpmaxe@ana",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.forwarding.remove(
    {"mailbox": "moc.elpmaxe@ana"}
)
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.ForwardingRemoveParams{
		Mailbox: "moc.elpmaxe@ana",
	}
	answer, err := client.Forwarding.Remove(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.forwarding.remove(
  mailbox: 'moc.elpmaxe@ana'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->forwarding->remove([
    'mailbox' => 'moc.elpmaxe@ana',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.ForwardingRemoveParams;
import app.mailset.model.ForwardingRemoveResult;

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

var params = ForwardingRemoveParams.builder()
        .mailbox("moc.elpmaxe@ana")
        .build();
ForwardingRemoveResult answer =
        mailset.forwarding().remove(params);
System.out.println(answer);
use mailset::types::ForwardingRemoveParams;

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

let answer = mailset
    .forwarding()
    .remove(ForwardingRemoveParams {
        mailbox: "moc.elpmaxe@ana".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/forwarding.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"moc.elpmaxe@ana"},"org":"org_3f9a1c0e7b2d"}'

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 forwarding remove moc.elpmaxe@ana
Response
{
  "ok": true,
  "data": {
    "removed": true
  }
}

forwarding.resend

Send the confirmation link to the destination again.

POST/v1/forwarding.resend

Admin or owner

Parameters

  • mailboxstringrequired

    The mailbox’s address.

Beside input

  • orgstringoptional

    The org this is about. Needed when the caller is in more than one.

Returns

data is the Forward object.

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.forwarding.resend({
	mailbox: "moc.elpmaxe@ana",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.forwarding.resend(
    {"mailbox": "moc.elpmaxe@ana"}
)
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.ForwardingResendParams{
		Mailbox: "moc.elpmaxe@ana",
	}
	answer, err := client.Forwarding.Resend(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.forwarding.resend(
  mailbox: 'moc.elpmaxe@ana'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->forwarding->resend([
    'mailbox' => 'moc.elpmaxe@ana',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Forward;
import app.mailset.model.ForwardingResendParams;

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

var params = ForwardingResendParams.builder()
        .mailbox("moc.elpmaxe@ana")
        .build();
Forward answer = mailset.forwarding().resend(params);
System.out.println(answer);
use mailset::types::ForwardingResendParams;

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

let answer = mailset
    .forwarding()
    .resend(ForwardingResendParams {
        mailbox: "moc.elpmaxe@ana".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/forwarding.resend \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"moc.elpmaxe@ana"},"org":"org_3f9a1c0e7b2d"}'

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 forwarding resend moc.elpmaxe@ana
Response
{
  "ok": true,
  "data": {
    "mailbox": "text",
    "destination": "text",
    "state": "none",
    "note": "text",
    "failures": 1,
    "policy": "passkey",
    "manageable": true,
    "route": true,
    "sent": true
  }
}