Skip to content

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

Groundmail

Groundmail for Vendure

An email sender for the Vendure EmailPlugin, for Vendure 2 and 3.
Order confirmations, password resets and email address verification go out through the Groundmail API.

npm License: MIT

Docs · Get a free account · groundmail.dev


Install

npm install vendure-plugin-groundmail
GROUNDMAIL_API_KEY=gm_your_key_here

Configure

Swap EmailPlugin.init() for GroundmailEmailPlugin.init(). It takes the same options, without transport:

// vendure-config.ts
import path from 'path'
import { VendureConfig } from '@vendure/core'
import { defaultEmailHandlers, FileBasedTemplateLoader } from '@vendure/email-plugin'
import { GroundmailEmailPlugin } from 'vendure-plugin-groundmail'

export const config: VendureConfig = {
  // ...
  plugins: [
    GroundmailEmailPlugin.init({
      handlers: defaultEmailHandlers,
      templateLoader: new FileBasedTemplateLoader(path.join(__dirname, '../static/email/templates')),
      globalTemplateVars: {
        fromAddress: '"Acme" <orders@yourdomain.com>',
        verifyEmailAddressUrl: 'https://shop.yourdomain.com/verify',
        passwordResetUrl: 'https://shop.yourdomain.com/password-reset',
        changeEmailAddressUrl: 'https://shop.yourdomain.com/verify-email-address-change',
      },
      groundmail: { apiKey: process.env.GROUNDMAIL_API_KEY },
    }),
  ],
}

The fromAddress must be on a domain you have verified in Groundmail.

Or keep EmailPlugin.init() and set the sender yourself:

import { EmailPlugin } from '@vendure/email-plugin'
import { GroundmailEmailSender } from 'vendure-plugin-groundmail'

EmailPlugin.init({
  // handlers, templateLoader, globalTemplateVars as before
  transport: { type: 'none' },
  emailSender: new GroundmailEmailSender({ apiKey: process.env.GROUNDMAIL_API_KEY }),
})

Vendure still renders your Handlebars and MJML templates. Groundmail sends the result, with the plain-text part, cc, bcc, reply-to and attachments (from content or a path to a file or URL).

With devMode: true, or the file and testing transports, emails go to the dev mailbox or your test callback as usual and nothing is sent.

Options

Option Purpose
apiKey Groundmail API key. Falls back to GROUNDMAIL_API_KEY
from From address when a handler sets none
replyTo Reply-To when a handler sets none
tags Tags added to every email, e.g. { app: 'shop' }
headers Headers added to every email
baseUrl Override the API base URL

Contributing

Found a bug or want something added? Open an issue. This code is published here on each release, so we port fixes rather than merging pull requests directly. The HTTP client itself is the groundmail package.

Why Groundmail

  • Mailboxes for your agents. Give an agent its own email address: it receives mail, replies in the thread and picks up sign-up codes on its own. No account needed to start. Agent mailboxes
  • Sign-in codes on their own IPs. Transactional email (sign-in codes, password resets, receipts) sends from its own IPs. Product email and opt-in newsletters share IPs built for that kind of mail, so a newsletter never shares a pool with your password resets. We run our own mail servers and never send cold outreach or bought lists.
  • Start free. Free covers 3,000 emails a month. After that, pay as you go is $15 a month with 20,000 emails included, then from $0.70 per 1,000, less as you grow. Pricing
  • Built for code and for agents. REST API, SMTP, SDKs for Node, Python, Go, PHP and Ruby, a CLI, and an MCP server for Claude, ChatGPT and Cursor.

All Groundmail libraries

Use Package
Node.js / TypeScript groundmail on npm
Python (Django), Go, Ruby (Rails Action Mailer) Groundmail/groundmail-sdks
PHP Groundmail/groundmail-php
Laravel Groundmail/groundmail-laravel
Symfony Mailer Groundmail/groundmail-symfony-mailer
Nodemailer Groundmail/groundmail-nodemailer
NestJS Groundmail/nestjs-groundmail
Strapi Groundmail/strapi-provider-email-groundmail
Medusa Groundmail/medusa-notification-groundmail
AdonisJS Groundmail/adonisjs-groundmail
Phoenix (Swoosh) Groundmail/swoosh_groundmail
CLI groundmail-cli on npm
MCP server (Claude, ChatGPT, Cursor) Groundmail/groundmail-mcp
Agent skills and Claude Code plugin Groundmail/groundmail-skills
Email templates (React Email, MJML, HTML) Groundmail/email-templates

Website · Docs · Pricing · Sign up free

Releases

Packages

Contributors

Languages