Mailbox pictures
The picture a mailbox shows inside Mailset.
An SDK signs every request with your key: Authentication. To sign one yourself, see Calling the API without an SDK.
On this page
avatars.set
Set a mailbox’s picture from a PNG, JPEG or WebP file.
POST/v1/avatars.set
Parameters
The mailbox’s address.
The picture file’s name.
At most 255 characters.
The file, base64.
Beside input
The org this is about. Needed when the caller is in more than one.
The body may be up to 7 MB.
Returns
data is an object with:
The mailbox’s address.
A short-lived URL for the picture.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.avatars.set({
address: "moc.elpmaxe@troppus",
name: "logo.png",
data: "<the message as base64>",
});
console.log(answer);
<the message as base64> is a whole email, headers and body: Send your own MIME.
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.avatars.set(
{
"address": "moc.elpmaxe@troppus",
"name": "logo.png",
"data": "<the message as base64>",
}
)
print(answer)
<the message as base64> is a whole email, headers and body: Send your own MIME.
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.AvatarsSetParams{
<the message as base64> is a whole email, headers and body: Send your own MIME.
require 'mailset'
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new
answer = mailset.avatars.set(
address: 'moc.elpmaxe@troppus',
name: 'logo.png',
data: '<the message as base64>'
)
p answer
<the message as base64> is a whole email, headers and body: Send your own MIME.
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->avatars->set([
'address' => 'moc.elpmaxe@troppus',
'name' => 'logo.png',
'data' => '<the message as base64>',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
<the message as base64> is a whole email, headers and body: Send your own MIME.
import app.mailset.Mailset;
import app.mailset.model.AvatarsSetParams;
import app.mailset.model.AvatarsSetResult;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = AvatarsSetParams.builder()
.address("moc.elpmaxe@troppus")
.name("logo.png")
.data("<the message as base64>")
.build();
AvatarsSetResult answer = mailset.avatars().set(params);
System.out.println(answer);
<the message as base64> is a whole email, headers and body: Send your own MIME.
use mailset::types::AvatarsSetParams;
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.avatars()
.set(AvatarsSetParams {
address: "moc.elpmaxe@troppus".into(),
name: "logo.png".into(),
data: "<the message as base64>".into(),
})
.await?;
println!("{answer:?}");
<the message as base64> is a whole email, headers and body: Send your own MIME.
curl https://mailset.app/v1/avatars.set \
-H "Authorization: Bearer $TOKEN" \
-H "ms-time: $MS_TIME" \
-H "ms-proof: $MS_PROOF" \
-H "Content-Type: application/json" \
-d '{"input":{"address":"moc.elpmaxe@troppus","name":"logo.png","data":"<base64 of the file>"},"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 avatars set moc.elpmaxe@troppus --file logo.png
{
"ok": true,
"data": {
"address": "moc.elpmaxe@olleh",
"picture": "text"
}
}
avatars.remove
Remove a mailbox’s picture.
POST/v1/avatars.remove
Parameters
The mailbox’s address.
Beside input
The org this is about. Needed when the caller is in more than one.
Returns
data is an object with:
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.avatars.remove({
address: "moc.elpmaxe@troppus",
});
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.avatars.remove(
{"address": "moc.elpmaxe@troppus"}
)
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.AvatarsRemoveParams{
Address: "moc.elpmaxe@troppus",
}
answer, err := client.Avatars.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.avatars.remove(
address: 'moc.elpmaxe@troppus'
)
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->avatars->remove([
'address' => 'moc.elpmaxe@troppus',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.AvatarsRemoveParams;
import app.mailset.model.AvatarsRemoveResult;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = AvatarsRemoveParams.builder()
.address("moc.elpmaxe@troppus")
.build();
AvatarsRemoveResult answer =
mailset.avatars().remove(params);
System.out.println(answer);
use mailset::types::AvatarsRemoveParams;
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.avatars()
.remove(AvatarsRemoveParams {
address: "moc.elpmaxe@troppus".into(),
})
.await?;
println!("{answer:?}");
curl https://mailset.app/v1/avatars.remove \
-H "Authorization: Bearer $TOKEN" \
-H "ms-time: $MS_TIME" \
-H "ms-proof: $MS_PROOF" \
-H "Content-Type: application/json" \
-d '{"input":{"address":"moc.elpmaxe@troppus"},"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 avatars remove moc.elpmaxe@troppus
{
"ok": true,
"data": {
"removed": true
}
}