EmailProvidersMailPace

MailPace

Send emails using the MailPace API with @visulima/email

MailPace Provider

The MailPace provider allows you to send emails through the MailPace API, a simple transactional email service.

Runtime Support: Universal (Node.js, Deno, Bun, Cloudflare Workers)

Setup

import { createMail } from "@visulima/email";
import { mailPaceProvider } from "@visulima/email/providers/mailpace";

const mail = createMail(
    mailPaceProvider({
        apiToken: process.env.MAILPACE_API_TOKEN!,
    }),
);

Configuration

The MailPaceConfig interface extends BaseConfig with the following options:

OptionTypeRequiredDefaultDescription
apiTokenstringYes-Your MailPace API token
endpointstringNohttps://app.mailpace.com/api/v1Custom API endpoint
debugbooleanNofalseEnable debug logging
loggerConsoleNo-Custom logger instance
retriesnumberNo3Number of retry attempts
timeoutnumberNo30000Request timeout in milliseconds

Basic Usage

import { MailMessage } from "@visulima/email";

const message = new MailMessage()
    .to("user@example.com")
    .from("sender@example.com")
    .subject("Hello from MailPace")
    .html("<h1>Hello World</h1>");

const result = await mail.send(message);

Provider-Specific Email Options

The MailPace provider supports additional options through MailPaceEmailOptions:

import type { MailPaceEmailOptions } from "@visulima/email/providers/mailpace";

const options: MailPaceEmailOptions = {
    from: { email: "sender@example.com" },
    to: { email: "user@example.com" },
    subject: "Hello",
    html: "<h1>Hello</h1>",
    tags: ["welcome"],
    listUnsubscribe: "https://example.com/unsubscribe",
};
OptionTypeDescription
tagsstring[]Tags for categorization
templateIdnumberMailPace template ID
templateVariablesRecord<string, unknown>Template variables
listUnsubscribestringList-Unsubscribe header value

Attachments

MailPace uses a specific attachment format:

const options: MailPaceEmailOptions = {
    from: { email: "sender@example.com" },
    to: { email: "user@example.com" },
    subject: "With attachment",
    html: "<h1>Hello</h1>",
    attachments: [
        {
            name: "document.pdf",
            content: "base64-encoded-content",
            content_type: "application/pdf",
        },
    ],
};

Supported Features

FeatureSupported
AttachmentsYes
Batch SendingNo
Custom HeadersYes
HTMLYes
Reply-ToYes
SchedulingNo
TaggingYes
TemplatesYes
TrackingNo
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues