Emails
Transactional emails for Medusa v2 in Polish and English: order, shipping, refund, return and account emails plus store team alerts, with React Email templates, Resend and SMTP providers, a send log and an admin UI.
Emails for Medusa
The emails every store needs, in Polish and English, ready on install: order, shipping, refund, return and account emails for customers, and alerts for the store team.
Installation · Configuration · Emails · Admin · Customizing · Testing
Requirements
- Medusa 2.22 or newer, Node.js 20.19+ or 22.12+
- A Resend account with a verified sending domain, or any SMTP server. Neither is needed to try the plugin in demo mode.
Installation
The package uses the Medusa packages your app already has (, , the admin SDK, UI and icons, , , , and ) as peer dependencies. Its own dependencies are for the templates and for SMTP.
Register it (Configuration) and run the migrations:
npx medusa db:migrateConfiguration
The plugin has two parts in : the plugin (templates, triggers, send log, admin) and a notification provider that does the sending. The plugin talks to Medusa's notification module, so the provider is swappable: use the Resend or SMTP provider from this package, or any other provider registered for the channel.
For SMTP, register this provider instead (Medusa allows one provider per channel, so pick one):
Missing options never stop Medusa. Without (or with invalid options) the plugin stays disabled and logs one line, ; the settings page shows the same reason. The providers behave the same way without or .
Environment variables
| Variable | |
|---|---|
| Resend API key with sending access. | |
| , , | SMTP server, when you use the SMTP provider. |
| Public URL of the storefront, for links in customer emails. | |
| URL of the admin, for "Open in admin" in store team emails. |
The names are yours to choose; the plugin only reads options. See .
Plugin options
| Option | Default | |
|---|---|---|
| required | Sender: or . | |
| Reply-to address. | ||
| Demo mode: render and log, send nothing. | ||
| Original language (BCP 47, ); see Languages. | ||
| Language by shipping country, for orders without a locale. | ||
| Without it, buttons that lead to the store are hidden and password reset emails are not sent. | ||
| Without it, store team emails have no "Open in admin" button. | ||
| see below | URL templates for the links in emails. | |
| , , , , , , , . | ||
| Who gets store team alerts until recipients are set in the admin. | ||
| Low stock threshold until it is changed in the admin. | ||
| Email types that start switched off, e.g. . | ||
| Attempts per email, including the first. | ||
| Notification channel the emails are sent on. | ||
| Replace templates or add your own email types. | ||
| Files to attach, e.g. an invoice PDF. |
defaults to the store's name in Medusa. takes , , , , , and as hex colors. takes (, , , , , ), (, , ), (, , ) and (, ). Admins can change the colours, style and logo on the Appearance tab; what they change is stored in the database and laid over these options field by field. is one string or one per language (), matched like the email text.
Links. Each entry of is a template; placeholders in are URL-encoded. is the email's language as a storefront path prefix ( for ), the full code. The defaults match the Medusa Next.js starter where it has a page:
| key | Default | Placeholders |
|---|---|---|
| , , , , | ||
| , , | ||
| , , | ||
| , |
When a link cannot be built (for example is not set), the button is left out rather than pointing nowhere.
Emails
| Type | Sent when | |
|---|---|---|
| Order confirmation | ||
| Payment received | ||
| Order fulfilled | , when the order is packed | |
| Order shipped | , with tracking numbers and the carrier's tracking link | |
| Order delivered | ||
| Order canceled | ||
| Refund issued | (one email per refund) | |
| Return requested | ||
| Return accepted | ||
| Welcome | , for customers with an account (not checkout guests) | |
| Email verification | ||
| Password reset | (customers and admin users) | |
| New order alert | , to the store team | |
| Low stock alert | A scheduled check, to the store team | |
| Failed payment alert | , to the store team |
Languages
The emails follow Medusa's Translation module:
- Translation module off: every email is written and sent in , the original language.
- Translation module on: emails can be written in every language of the store (Settings → Store), in the admin editor. The original language is ; set it to the store's code for it ().
English and Polish have built-in text, for any code in them (, , ). Other languages start empty. Each field that is not translated is sent in the original language, so a half-translated email mixes the two until it is done. A base language without built-in text uses the English one.
Customer emails pick the language from, in order: the order's , , , the language mapped to the shipping country (). The first one the store has is used (the same code, else the same language), otherwise . Store team emails use .
Text saved for a language the store no longer has is kept, unused, and comes back with the language.
Notifications turned off. Fulfillments and returns created with "send notification" unchecked in the admin do not send emails.
Email verification
Medusa 2.22 has its own verification flow: creates a code and emits , and checks it. The plugin sends the code (and a link built from ) when that event carries an email address. You need an auth verification provider configured in Medusa and a storefront page that calls the confirm route; see Medusa's auth documentation. The plugin does not create codes or mark anything as verified itself.
Low stock alerts
Every 30 minutes the plugin compares each inventory level (stocked minus reserved) with the threshold from Emails → Settings. New shortages are sent as one email; an item is reported once and again only after it has been restocked above the threshold.
Failed payment alerts
Medusa has no event for a failed payment, so the plugin listens to its own. Emit it from a payment integration's webhook handler or from your code:
How it works
- Sent once per event. Before an email goes out, a row with a dedupe key () is written to the send log; a unique index rejects the second one. Events that Medusa delivers twice send one email.
- Retries. When the provider fails, the email is retried after 1, 5, 30 and 120 minutes ( in total) by a job that runs every two minutes. With Resend every attempt carries the same idempotency key, so a retry can never deliver twice. With SMTP, a failure where the server may already have taken the message (a timeout during transfer) is not retried automatically; the log says so and you can resend by hand.
- Secrets. Password reset tokens and verification codes are put into the email and nowhere else: not in the send log, not in workflow executions, not in log lines. Those emails are retried only immediately and cannot be resent. Email addresses are masked in log lines.
- What is stored. The send log keeps the recipient, subject, status, error and the small input needed to render the email again (IDs), not the rendered email.
Demo mode
Every email is rendered and written to the send log with the status , and a log line says what would have been sent. Nothing reaches the notification module, so no provider is needed. Previews, test sends and resends work the same way.
The admin page shows a demo bar with Restore test data, so the History tab has something to show before any real email exists. It fills the send log with a month of sample emails for the store's latest twelve orders and registered customers (built-in sample orders when there are none):
- every email type: order confirmations and team alerts, payments, fulfilment, shipping and delivery, a cancellation, a return with its refund, welcome emails, a verification code, a password reset, a low stock alert and a failed payment;
- every status: sent, failed with the transport's reason (unknown mailbox, full mailbox, a timeout after three attempts), pending, demo (a test send), and a failed confirmation resent after the address was fixed.
Emails of real orders can be previewed and resent (in demo mode a resend is only logged). Sample rows are marked by their dedupe key (): a restore replaces them and never touches real log entries, and the retry job never picks them up. Nothing is sent.
Admin
Emails in the main menu, with five tabs:
- History (the first tab): the send log with search by recipient and a status filter, and a Resend button per email.
- Templates: every email type with an on/off toggle, grouped into orders, customer account and store team, and "Shared texts" (greeting, sign-off, table labels and footer of every email). Each email opens an editor: the text in every store language, picked from a select that shows what each translation still misses, and a live preview rendered with a real order from the store. Variables show as chips with a readable name ("Order number" instead of ): click one in the list to insert it where the cursor is, click a chip in the text to select it, its × removes it; variables the email cannot use show in red. Also send a test and restore defaults (you type the email's name to confirm).
- Appearance: colour palettes and each of the seven colours, the font, button and card shapes, header alignment and the logo, with a live preview of any email. "Restore the options' look" goes back to from the plugin options.
- Settings: sender, languages and links as configured, store team recipients and the low stock threshold (with a way back to the plugin options; each alert can have its own recipients), and "Reset everything" (you type ; the send log is never reset).
- Rollout guide: what the plugin does, the steps from installation to production with their status detected from your store, and a prompt for an AI assistant.
Settings → Translations gets a card pointing to the Emails page, where email texts are translated.
Order and customer pages get a panel with the emails sent for that record and a Resend button. A resend is a new email with the order's current data, sent to the same address.
The admin is in English and Polish.
Customizing
Text
Edit it in the admin. Text is plain (no HTML); a blank line starts a new paragraph. Variables such as or are listed in the editor per email, and unknown ones are rejected on save.
Attachments
Give the plugin a resolver and it attaches what the resolver returns, for example an invoice from an invoicing plugin or a return label:
is one function for every email or an object keyed by email type. The resolver runs on every attempt, including retries and resends. If it throws, the email is sent without the files and a warning is logged. Up to 10 files per email.
Your own templates
Templates are React Email components. Replace a built-in one, or register a new email type with its own text:
A custom type shows up in the admin with its name, description and source, a toggle, editable text, preview and test send. "Missing translations" names the store languages that still have no text of their own. renders the heading, greeting, body, button (when the data has ), note and sign-off around your content; the package also exports , , , , , , and .
Workflows and events
Send any registered email type from your code through the same pipeline (toggle, language, branding, edited text, send log, retries, demo mode):
must be plain JSON: it is stored so the email can be retried and resent. Pass when it holds a secret, and it will not be stored. resends an email from the log by ID.
For emails people signed up for, put in : the footer then shows an "Unsubscribe" link and the email gets a header (passed on by the Resend and SMTP providers). Add when that URL unsubscribes on a POST without further confirmation, for mail clients' one-click unsubscribe (RFC 8058). The back-in-stock plugin uses this.
The plugin emits and with , and listens to (above).
What it does not do
- No marketing emails, newsletters or unsubscribe handling.
- No abandoned cart emails out of the box (add one as a custom type).
- No HTML or drag-and-drop editing in the admin: admins edit text; the layout is code.
- No built-in text in languages other than English and Polish. Other store languages are translated in the admin (or carried by custom templates).
- No delivery tracking (opens, bounces). The send log records what was handed to the provider.
- It does not create verification codes; see Email verification.
API
Admin routes, all under and behind admin authentication:
| Route | |
|---|---|
| Enabled or the reason it is not, demo mode, sender. | |
| "Restore test data" for the send history (demo mode only). | |
| Store team recipients and low stock threshold. | |
| Appearance; restores the plugin options. | |
| Rollout steps with their detected status. | |
| Email types with their toggles. | |
| One type: toggle, recipients, text. may be . | |
| Render with a real order (and unsaved or ). | |
| Send a test to . | |
| Restore defaults; needs . | |
| Restore all settings; needs . | |
| Send log; filter by , , , . | |
| Resend an email from the log. |
Testing
- Demo mode first. Set , place an order, and look at Emails → History and at the previews.
- Resend. Create an API key at resend.com → API Keys and verify your domain (Domains). Until the domain is verified you can send from to your own account address only. Set to an address on the verified domain, register the Resend provider and use Send a test in the editor of any email.
- SMTP. Any server works; for local testing a catcher such as Mailpit () shows the emails without sending them.
Troubleshooting
- at startup: the plugin options are missing or invalid; the message names the option.
- Emails show as failed with "Could not find a notification provider for channel: email": no provider is registered for the channel in the notification module's options.
- Resend answers 403: the domain is not verified in Resend, or the API key has no sending access.
- No password reset email: (or for admin users) is not set; the settings page says so.
- Store team alerts are not sent: no recipients are set; the list shows a "No recipients" badge.
- Wrong language: see how the language is picked; check that the language is in Settings → Store, set , or store the locale on the order or customer.
- Only one language in the editor: Medusa's Translation module is off, or the store has no other languages (Settings → Store).
Development
See docs/development.md and the repository's CONTRIBUTING.md.
License
MIT © 2026 Bitshaft. Resend is a trademark of its owner; this plugin is not affiliated with or endorsed by Resend. See TRADEMARKS.md.

