Skip to main content
Home

Built and signed on GitHub Actions

Mailgun transport for Upyo email library

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 Score
100%
Published
a week ago (0.3.1)
method MailgunTransport.prototype.sendMany
MailgunTransport.prototype.sendMany(
messages: Iterable<Message> | AsyncIterable<Message>,
options?: TransportOptions,
): AsyncIterable<Receipt>

Sends multiple email messages efficiently via Mailgun API.

This method sends each message individually but provides a streamlined interface for processing multiple messages. Each message is sent as a separate API request to Mailgun.

Examples

Example 1

const messages = [
  {
    sender: { address: 'from@example.com' },
    recipients: [{ address: 'user1@example.com' }],
    ccRecipients: [],
    bccRecipients: [],
    replyRecipients: [],
    subject: 'Message 1',
    content: { text: 'Hello User 1!' },
    attachments: [],
    priority: 'normal',
    tags: [],
    headers: new Headers()
  },
  {
    sender: { address: 'from@example.com' },
    recipients: [{ address: 'user2@example.com' }],
    ccRecipients: [],
    bccRecipients: [],
    replyRecipients: [],
    subject: 'Message 2',
    content: { text: 'Hello User 2!' },
    attachments: [],
    priority: 'normal',
    tags: [],
    headers: new Headers()
  }
];

for await (const receipt of transport.sendMany(messages)) {
  if (receipt.successful) {
    console.log('Sent:', receipt.messageId);
  } else {
    console.error('Failed:', receipt.errorMessages);
  }
}

Parameters

messages: Iterable<Message> | AsyncIterable<Message>

An iterable or async iterable of messages to send.

optional
options: TransportOptions

Optional transport options including AbortSignal for cancellation.

Return Type

AsyncIterable<Receipt>

An async iterable of receipts, one for each message.

New Ticket: 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/mailgun

Import symbol

import { MailgunTransport } from "@upyo/mailgun";
or

Import directly with a jsr specifier

import { MailgunTransport } from "jsr:@upyo/mailgun";

Add Package

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

Import symbol

import { MailgunTransport } from "@upyo/mailgun";

Add Package

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

Import symbol

import { MailgunTransport } from "@upyo/mailgun";

Add Package

vlt install jsr:@upyo/mailgun

Import symbol

import { MailgunTransport } from "@upyo/mailgun";

Add Package

npx jsr add @upyo/mailgun

Import symbol

import { MailgunTransport } from "@upyo/mailgun";

Add Package

bunx jsr add @upyo/mailgun

Import symbol

import { MailgunTransport } from "@upyo/mailgun";