Integration Module 2.0 for Medusa is outRead the announcement
Mailgun logo

Mailgun

Send and manage email notifications

npm install @webbers/mailgun-notification-medusa
Built by
Service
Version
1.1.2
Last updated
10 months ago
Monthly downloads
Loading downloads

Medusa logo

Mailgun notifications plugin for Medusa V2

Send emails using Mailgun.

PRs welcome!
Website Website

Table of Contents

Prerequisites

  • Node.js v20 or higher
  • Medusa server v2.3.0 or higher
  • A Mailgun account and API key and domain

Note

If you use Mailgun's EU-hosted infrastructure, you need this url as the api_url: https://api.eu.mailgun.net

Installation

Configuration

Add the provider to the module in your file:

Configuration Options

OptionDescriptionDefault
Your Mailgun API keyRequired
Your Mailgun domainRequired
Your from email addressRequired
Your email template functionsRequired
The default locale for the emailsRequired
The API url of mailgunOptional

Environment Variables

Create or update your file with the following variables:

Usage

To set up up your email templates two functions are required per template:

  • A function that takes a locale as a parameter and returns the subject of the email
  • A function that takes the props of the email as a parameter and returns the template of the email For example you could set it up like this:
  1. In the src directory of your medusa server create a directory called
  2. Inside the emails directory create a file called
  3. Inside the order-placed.tsx file add the following code:

  1. In the file add the following code:

Local development and customization

In case you want to customize and test the plugin locally, refer to the Medusa Plugin docs.