Sending

Tags

Attach name/value tags to an email for categorization and reporting.

Attach metadata to an email with the tags array — a list of { name, value } pairs. Tags travel with the message, where they can be used to segment metrics and feed your own reporting. After the email is sent, its tags are also included on the webhook events emitted for that email.

Common uses are associating an email with a customer id from your application, labelling a plan tier like free or enterprise, or noting the category of message such as welcome or password_reset.

Tag fields

namestringrequired

The tag name (e.g. category). May contain ASCII letters, numbers, underscores, or dashes only.

valuestringrequired

The tag value (e.g. welcome). May contain ASCII letters, numbers, underscores, or dashes only.

You can attach up to 75 tags per email. Tag names and values are restricted to ASCII letters, numbers, underscores, and dashes.

Example

import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.emails.send({
  "from": "Acme <hello@yourdomain.com>",
  "to": ["delivered@example.com"],
  "subject": "Welcome aboard",
  "html": "<p>Glad to have you.</p>",
  "tags": [
    { "name": "category", "value": "welcome" },
    { "name": "tier", "value": "free" }
  ]
});
console.log({ data, error });
Tags you set are stored on the email and returned by GET /emails/:id in the tags field.