EmailProvidersMailCrab

MailCrab

Use MailCrab for local email development and testing with @visulima/email

MailCrab Provider

The MailCrab provider wraps the SMTP provider to send emails to a MailCrab instance, a local development email testing tool. MailCrab captures all emails sent to it and provides a web interface for viewing them.

Runtime Support: Node.js only (wraps the SMTP provider which requires node:net and node:tls)

Setup

First, start MailCrab locally (e.g., via Docker):

docker run -p 1080:1080 -p 1025:1025 marlonb/mailcrab

Then configure the provider:

import { createMail } from "@visulima/email";
import { mailCrabProvider } from "@visulima/email/providers/mailcrab";

const mail = createMail(
    mailCrabProvider({
        host: "localhost",
        port: 1025,
    }),
);

Configuration

The MailCrabConfig interface extends BaseConfig with the following options:

OptionTypeRequiredDefaultDescription
hoststringNolocalhostMailCrab SMTP host
portnumberNo1025MailCrab SMTP port
securebooleanNofalseUse secure connection
debugbooleanNofalseEnable debug logging
loggerConsoleNo-Custom logger instance

Basic Usage

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

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

const result = await mail.send(message);
// View the email at http://localhost:1080

Supported Features

Since MailCrab wraps the SMTP provider, it supports the same features as SMTP:

FeatureSupported
AttachmentsYes
Batch SendingNo
Custom HeadersYes
HTMLYes
Reply-ToYes
SchedulingNo
TaggingNo
TemplatesNo
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