Access is invite-only during beta. Once invited, create a key to personalize these examples. Production sending requires a separate review.

Send emails with NestJS

Import PostShibaModule and call sendMail.

The Nest entry is a module and an injectable token, not a mailer. Import postshiba without Nest. Import postshiba/nest only in Nest apps. sendMail maps to, from, subject, html, text, and attachments onto emails.send.

send.ts
1 import { Inject, Injectable } from "@nestjs/common"
2 import { POSTSHIBA, sendMail } from "postshiba/nest"
3 import type { PostShiba } from "postshiba"
4
5 @Injectable()
6 export class MailService {
7 constructor(@Inject(POSTSHIBA) private readonly postshiba: PostShiba) {}
8
9 sendWelcome() {
10 return sendMail(this.postshiba, {
11 from: "hello@mail.example.com",
12 to: "you@example.com",
13 subject: "Welcome",
14 text: "hello",
15 html: "<p>hello</p>",
16 })
17 }
18 }

Installation

install.sh
1 npm install github:postshiba/postshiba-node

Node 18 or later. Open pull requests on postshiba/sdks.

app.module.ts
1 import { Module } from "@nestjs/common"
2 import { PostShibaModule } from "postshiba/nest"
3
4 @Module({
5 imports: [
6 PostShibaModule.register({
7 apiKey: "YOUR_API_KEY",
8 teamId: "KjkAJW",
9 }),
10 ],
11 })
12 export class AppModule {}

Errors and throttling

Failed responses throw PostShibaError with error, field, and message.

A 429 with error throttled means the cluster hit its hourly throttle or its 24-hour cap. Do not retry that send immediately. Immediate retries hit the same cap.

The Nest module does not delay for you. In a queued job, catch PostShibaError and check err.error === "throttled" before sending again.

See Errors.

About

PostShiba is the email platform that powers Bento behind the scenes. You can build your own products, like Bento, on top of it.

© 2026 PostShiba by Backpack Internet Pty. Ltd. All rights reserved.

The same policies that govern Bento are applied to PostShiba Privacy | Terms | Security