Skip to main content
Home
This release is 4 versions behind 0.4.0 — the latest version of @upyo/plunk. Jump to latest

@upyo/plunk@0.3.1
Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score100%
Downloads1/wk
Published2 months ago (0.3.1)

Plunk transport for Upyo email library

@upyo/plunk

JSR npm

Plunk transport for the Upyo email library.

Installation

npm  add       @upyo/core @upyo/plunk
pnpm add       @upyo/core @upyo/plunk
yarn add       @upyo/core @upyo/plunk
deno add --jsr @upyo/core @upyo/plunk
bun  add       @upyo/core @upyo/plunk

Usage

import { createMessage } from "@upyo/core";
import { PlunkTransport } from "@upyo/plunk";
import fs from "node:fs/promises";
import process from "node:process";

const message = createMessage({
  from: "sender@example.com",
  to: "recipient@example.net",
  subject: "Hello from Upyo!",
  content: { text: "This is a test email." },
  attachments: [
    new File(
      [await fs.readFile("image.jpg"), "image.jpg", { type: "image/jpeg" }]
    )
  ],
});

const transport = new PlunkTransport({
  apiKey: process.env.PLUNK_API_KEY!,
});

const receipt = await transport.send(message);
if (receipt.successful) {
  console.log("Message sent with ID:", receipt.messageId);
} else {
  console.error("Send failed:", receipt.errorMessages.join(", "));
}

Configuration

See the Plunk docs for more information about configuration options.

Available Options

  • apiKey: Your Plunk API key
  • baseUrl: API base URL (default: https://api.useplunk.com)
  • timeout: Request timeout in milliseconds (default: 30000)
  • retries: Number of retry attempts (default: 3)
  • validateSsl: Whether to validate SSL certificates (default: true)
  • headers: Additional HTTP headers (default: {})

Self-hosted instances

This transport supports self-hosted Plunk instances. Set the baseUrl to your domain followed by /api:

import { PlunkTransport } from "@upyo/plunk";

const transport = new PlunkTransport({
  apiKey: "your-api-key",
  baseUrl: "https://mail.yourcompany.com/api",
});
Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@upyo/plunk

Import symbol

import * as plunk from "@upyo/plunk";
or

Import directly with a jsr specifier

import * as plunk from "jsr:@upyo/plunk";

Add Package

pnpm i jsr:@upyo/plunk
or (using pnpm 10.8 or older)
pnpm dlx jsr add @upyo/plunk

Import symbol

import * as plunk from "@upyo/plunk";

Add Package

yarn add jsr:@upyo/plunk
or (using Yarn 4.8 or older)
yarn dlx jsr add @upyo/plunk

Import symbol

import * as plunk from "@upyo/plunk";

Add Package

vlt install jsr:@upyo/plunk

Import symbol

import * as plunk from "@upyo/plunk";

Add Package

npx jsr add @upyo/plunk

Import symbol

import * as plunk from "@upyo/plunk";

Add Package

bunx jsr add @upyo/plunk

Import symbol

import * as plunk from "@upyo/plunk";