1 ---
2 keywords:
3 - email
4 - mail
5 - medusa mail
6 - transactional email
7 - marketing email
8 - email service
9 - cloud email
10 - medusa cloud email
11 - medusa emails
12 ---
13
14 import { CodeTabs, CodeTab, Note, Prerequisites, InlineIcon, getOsShortcut, Kbd } from "docs-ui"
15 import { TriangleRightMini } from "@medusajs/icons"
16
17 export const metadata = {
18 title: `Medusa Emails`,
19 keywords: [
20 "email",
21 "mail",
22 "medusa mail",
23 "transactional email",
24 "marketing email",
25 "email service",
26 "cloud email",
27 "medusa emails",
28 ],
29 }
30
31 # {metadata.title}
32
33 In this chapter, you'll learn about Medusa Emails and how to send emails in your Cloud projects.
34
35 ## What is Medusa Emails?
36
37 Medusa Emails is a built-in email sending service for Cloud organizations and projects.
38
39 <Note title="Not a Cloud user yet?">
40
41 [Sign up for Cloud](../sign-up/page.mdx) to use Medusa Emails and other Cloud features.
42
43 </Note>
44
45 Medusa Emails allows you to send transactional and marketing emails like order confirmations directly from your Medusa application without needing to set up and manage your own email infrastructure.
46
47 Medusa Emails is available for all Cloud plans, with different sending limits based on your [plan](../pricing/page.mdx). You can use it out-of-the-box without manual configuration.
48
49 Through your organization's dashboard, you can also monitor email sending statistics and manage your email sender domain.
50
51 ---
52
53 ## Set Up Medusa Emails in Cloud Projects
54
55 Medusa Emails is enabled by default for all Cloud projects and organizations with zero configuration.
56
57 ### Remove Other Email Notification Module Providers
58
59 Medusa enables Medusa Emails by default for all Cloud projects if you haven't configured a [Notification Module Provider](!resources!/infrastructure-modules/notification) for the `email` channel in your Medusa application.
60
61 So, if you have a notification provider like the [SendGrid Notification Module Provider](!resources!/infrastructure-modules/notification/sendgrid), remove it from your Medusa application to use Medusa Emails.
62
63 #### Local Development Email Setup
64
65 Since Medusa Emails isn't available for local development, you can set up the [Local Notification Module Provider](!resources!/infrastructure-modules/notification/local) to test email sending functionality in your local environment. This provider will log the email details to the console instead of sending them.
66
67 For example, you can add the following configuration to `medusa-config.ts`:
68
69 ```ts title="medusa-config.ts"
70 module.exports = defineConfig({
71 // ...
72 modules: [
73 {
74 resolve: "@medusajs/medusa/notification",
75 options: {
76 providers: [
77 // ...
78 {
79 resolve: "@medusajs/medusa/notification-local",
80 id: "local",
81 options: {
82 channels: [
83 process.env.NODE_ENV === "development"
84 ? "email"
85 : "feed",
86 ],
87 },
88 },
89 ],
90 },
91 },
92 ],
93 })
94 ```
95
96 In this setup, the Local Notification Module Provider is used for the `email` channel only in the development environment. In other environments, it uses the `feed` channel.
97
98 ### (Optional) Add Email Sender Domain to Cloud
99
100 By default, Medusa Emails sends emails using a randomly generated email address at the domain `medusajsemails.com`.
101
102 If you don't add an email sender domain, you can only send emails to addresses of users in your Cloud organization.
103
104 To send emails to external email addresses, [add an email sender domain](#add-email-sender-domain-to-cloud).
105
106 ---
107
108 ## Send Emails on Cloud
109
110 To send emails using Medusa Emails in your Cloud project, create a notification that's sent through the `email` channel in your project's code.
111
112 For example:
113
114 <CodeTabs group="medusa-email-example">
115 <CodeTab label="Workflow" value="workflow">
116
117 ```ts
118 import { createWorkflow } from "@medusajs/framework/workflows-sdk"
119 import { sendNotificationsStep } from "@medusajs/medusa/core-flows"
120
121 type Input = {
122 email: string
123 }
124
125 const myWorkflow = createWorkflow(
126 "my-workflow",
127 (input: Input) => {
128 const data = sendNotificationsStep({
129 // must either have an added sender domain or use an email
130 // address that belongs to your Cloud organization
131 to: input.email,
132 channel: "email",
133 content: {
134 html: "<h1>Welcome to Medusa Emails!</h1><p>This is a test email sent using Medusa Emails in a Cloud project.</p>",
135 subject: "Welcome to Medusa Emails",
136 },
137 })
138 }
139 )
140 ```
141
142 </CodeTab>
143 <CodeTab label="Scheduled Job / Subscriber / API Route" value="job">
144
145 ```ts
146 import { Modules } from "@medusajs/framework/utils"
147
148 // ...
149
150 const notificationModuleService = container.resolve(
151 Modules.NOTIFICATION
152 )
153
154 await notificationModuleService.createNotifications({
155 // must either have an added sender domain or use an email
156 // address that belongs to your Cloud organization
157 to: "user@example.com",
158 channel: "email",
159 content: {
160 html: "<h1>Welcome to Medusa Emails!</h1><p>This is a test email sent using Medusa Emails in a Cloud project.</p>",
161 subject: "Welcome to Medusa Emails",
162 },
163 })
164 ```
165
166 </CodeTab>
167 </CodeTabs>
168
169 When this code is executed in your Cloud project, Medusa sends the email using Medusa Emails. You can track whether the email was delivered on the [Email Activity page](#monitor-email-sending-activity-on-cloud).
170
171 ### Writing Email Templates
172
173 To write email templates for Medusa Emails, use packages like [react-email](https://react.email). React Email lets you create email templates using React components with preview and testing capabilities.
174
175 Refer to the [Set Up React Email Templates](./react-email/page.mdx) guide to learn how to set up React Email templates in your Cloud project with examples.
176
177 ---
178
179 ## Add Email Sender Domain to Cloud
180
181 <Prerequisites
182 items={[
183 {
184 text: "A domain that you own and can access its DNS settings.",
185 },
186 ]}
187 />
188
189 <Note>
190
191 Verified email sender domains are available for Launch, Scale, and Enterprise plans only. Learn more about plan features on the [pricing page](../pricing/page.mdx).
192
193 </Note>
194
195 To send emails to external email addresses using Medusa Emails, you need to add an email sender domain in your Cloud organization. You can add multiple sender domains if needed.
196
197 To add your email sender domain:
198
199 <Note title="Tip">
200
201 You can also navigate to the sender domains form from the [command palette](../command-palette/page.mdx). Press <Kbd>{getOsShortcut()}</Kbd> + <Kbd>K</Kbd> and select **Add Sender Domain**.
202
203 </Note>
204
205 1. If you're in a different organization, [switch to the organization](../organizations/page.mdx#switch-organization).
206 2. Click **Projects** in the sidebar and select a project.
207 3. Click **Emails** -> **Sender Domains** from the sidebar.
208 4. Click the **Add sender domain** button.
209 5. In the form that opens, enter the domain you want to add (for example, `yourdomain.com`) and click **Continue**.
210
211 After submitting, you'll be taken to the domain's detail page where the required DNS records are shown. Add these records to your domain's DNS settings:
212
213 - **DKIM** (labeled **Required**): DomainKeys Identified Mail records that authenticate your emails. You must add these records to send emails from your domain.
214 - **SPF**: (Optional) Sender Policy Framework records that help receiving mail servers verify your domain. Adding SPF records improves deliverability but is not required.
215 - **DMARC**: (Optional) Domain-based Message Authentication records that build on DKIM and SPF to protect against email spoofing. Adding DMARC records is recommended for improved email security but is not required.
216
217 If you're unsure how to add DNS records, refer to your domain registrar's documentation or support.
218
219 The domain will then be verified periodically. This process may take a few minutes to several hours, depending on your DNS provider.
220
221 ### View Domain Verification Status
222
223 After adding a sender domain, you can view its verification status on the domain detail page. To open it, click the domain name in the **Sender Domains** list.
224
225 The detail page is organized into three sections: **DKIM**, **SPF**, and **DMARC**. Each section shows whether the corresponding DNS records have been verified. The domain header also shows when the most recent verification check ran.
226
227 ### Provisioning Failure
228
229 If the domain's status is **Provisioning failed**, the domain detail page replaces the DNS configuration instructions with an alert explaining the failure. The **Check records** and **Restart verification** buttons are not available when provisioning has failed. Contact support if you encounter this state.
230
231 ### Verify DNS Records Manually
232
233 You can trigger an immediate DNS check at any time instead of waiting for the next automatic check by clicking the **Check records** button at the top right of the domain detail page.
234
235 ### Restart DNS Verification
236
237 To restart the verification process from the beginning at any time, click the **Restart Verification** button at the top right of the domain detail page.
238
239 ### Diagnose DNS Record Issues
240
241 On the domain detail page, you can click the <InlineIcon Icon={TriangleRightMini} alt="expand" /> icon for any record whose verification status is failing. This shows:
242
243 - The actual DNS records currently found for that entry, if any.
244 - A `dig` command (macOS/Linux) you can copy and run in your terminal to check the record yourself.
245 - An `nslookup` command (Windows) you can copy and run in your terminal.
246 - A link to [Google's Dig tool](https://toolbox.googleapps.com/apps/dig/) to check the record in your browser.
247
248 Use these diagnosis details to verify and fix any issues in your domain's DNS records. For example, if a different value is set for a record, make sure you set the correct value.
249
250 ### Specify From Email
251
252 After adding your email sender domain, specify a `from` property in the notification to set the sender email address.
253
254 For example:
255
256 <CodeTabs group="medusa-email-from-example">
257 <CodeTab label="Workflow" value="workflow">
258
259 ```ts
260 import { createWorkflow } from "@medusajs/framework/workflows-sdk"
261 import { sendNotificationsStep } from "@medusajs/medusa/core-flows"
262
263 type Input = {
264 email: string
265 }
266
267 const myWorkflow = createWorkflow(
268 "my-workflow",
269 (input: Input) => {
270 const data = sendNotificationsStep({
271 to: input.email,
272 from: "no-reply@yourdomain.com",
273 channel: "email",
274 content: {
275 html: "<h1>Welcome to Medusa Emails!</h1><p>This is a test email sent using Medusa Emails in a Cloud project.</p>",
276 subject: "Welcome to Medusa Emails",
277 },
278 })
279 }
280 )
281 ```
282
283 </CodeTab>
284 <CodeTab label="Scheduled Job / Subscriber / API Route" value="job">
285
286 ```ts
287 import { Modules } from "@medusajs/framework/utils"
288
289 // ...
290
291 const notificationModuleService = container.resolve(
292 Modules.NOTIFICATION
293 )
294
295 await notificationModuleService.createNotifications({
296 to: "user@example.com",
297 from: "no-reply@yourdomain.com",
298 channel: "email",
299 content: {
300 html: "<h1>Welcome to Medusa Emails!</h1><p>This is a test email sent using Medusa Emails in a Cloud project.</p>",
301 subject: "Welcome to Medusa Emails",
302 },
303 })
304 ```
305
306 </CodeTab>
307 </CodeTabs>
308
309 The email will be sent from the `no-reply@yourdomain.com` address, assuming it belongs to your verified sender domain.
310
311 ---
312
313 ## Monitor Email Sending Activity on Cloud
314
315 You can monitor email sending activity like sent emails, delivery rates, open rates, and click rates for your Cloud organization using the Email Activity page in your Cloud dashboard.
316
317 To view email sending activity:
318
319 <Note title="Tip">
320
321 You can also navigate to the Email Activity page from the [command palette](../command-palette/page.mdx). Press <Kbd>{getOsShortcut()}</Kbd> + <Kbd>K</Kbd> and select **Sender Domains**.
322
323 </Note>
324
325 1. If you're in a different organization, [switch to the organization](../organizations/page.mdx#switch-organization).
326 2. Click **Projects** in the sidebar and select a project.
327 3. Click **Emails** -> **Activity** from the sidebar.
328
329 At the top of the Email Activity page, you'll see email sending statistics for your organization across all projects, including:
330
331 - **Sent**: Total number of sent emails in the specified time range.
332 - **Deliverability Rate**: Percentage of sent emails that were successfully delivered to recipients.
333 - **Open Rate**: Percentage of delivered emails that were opened by recipients.
334 - **Click Rate**: Percentage of opened emails where recipients clicked on links within the email.
335 - **Bounce Rate**: Percentage of sent emails that were not delivered due to permanent delivery failures.
336 - **Complaint Rate**: Percentage of sent emails that recipients marked as spam or junk.
337
338 Below the statistics, you'll find a detailed list of sent emails.
339
340 ![Email Activity page showing email sending statistics and a list of sent emails](https://res.cloudinary.com/dza7lstvk/image/upload/v1762948757/Cloud/CleanShot_2025-11-12_at_13.59.02_2x_uetth1.png)
341
342 ### Change Email Activity Time Range
343
344 To change the time range for email activity statistics and the list of sent emails, click the time range dropdown at the top right of the page. You can choose custom ranges or predefined ranges like "Last 7 days" or "Last 30 days".
345
346 ![Time range dropdown opened on the Email Activity page](https://res.cloudinary.com/dza7lstvk/image/upload/v1762948832/Cloud/CleanShot_2025-11-12_at_14.00.17_2x_bqlopg.png)
347
348 The earliest selectable start date depends on your organization's [plan](../pricing/page.mdx):
349
350 - **Develop plan**: You can query email logs from up to the past 12 hours.
351 - **Launch and Scale plans**: You can query email logs from up to the past 3 days.
352
353 If you select a start date earlier than what your plan allows, the picker automatically moves it forward to the earliest permitted time.
354
355 ### Filter Emails by Project
356
357 By default, the Email Activity page shows emails from all projects in your Cloud organization.
358
359 To filter emails by a specific project, click the "All projects" dropdown at the top right of the page and select the desired project.
360
361 This updates the email sending statistics and list to show only emails from the selected project.
362
363 ![Project filter dropdown opened on the Email Activity page](https://res.cloudinary.com/dza7lstvk/image/upload/v1762948832/Cloud/CleanShot_2025-11-12_at_14.00.17_2x_bqlopg.png)
364
365 ### View Email Details
366
367 To view an email's details, click the email entry in the list on the Email Activity page.
368
369 At the top of the Email Details page, you'll see an overview of the email's event history, including when it was sent, delivered, opened, and when its links were clicked.
370
371 Below that, you'll see a preview of the email content as it was sent to the recipient, with support for both HTML and plain text views.
372
373 ![Email Details page showing the email's event history and a preview of the email content](https://res.cloudinary.com/dza7lstvk/image/upload/v1762950939/Cloud/CleanShot_2025-11-12_at_14.03.33_2x_tv6ydx.png)
374
375 ---
376
377 ## Troubleshoot Email Delivery Issues on Cloud
378
379 If you try to send an email using Medusa Emails in your Cloud project and it's not delivered, consider these troubleshooting steps:
380
381 1. **Check Email Activity**: Go to the [Email Activity page](#monitor-email-sending-activity-on-cloud) in your Cloud organization's dashboard to see if the email appears in the list. If it does, check its status and event history for delivery issues.
382 2. **Verify Sender Domain**: If you're sending emails to external addresses, ensure you've verified your email sender domain in your Cloud organization. Without a verified sender domain, you can only send emails to addresses in your Cloud organization.
383 3. **Check Logs**: Review your project's [logs](../logs/page.mdx#view-runtime-logs-on-cloud) for errors or warnings related to email sending. Look for issues that might indicate why the email wasn't sent or delivered.
384 4. **Check Spam/Junk Folder**: Ask the recipient to check their spam or junk email folder. Sometimes emails may be incorrectly marked as spam by email providers.
385 5. **Contact Support**: If you've tried the above steps and are still experiencing issues, contact support for assistance.
386
387 <Note>
388
389 If the email activity and logs don't show a cause related to your application, [check the Cloud status page](../status/page.mdx) for ongoing Cloud incidents that may be affecting email delivery.
390
391 </Note>