Installation

Install the @perseidesjs/notification-nodemailer plugin in your Medusa project:

npm install @perseidesjs/notification-nodemailer

Configuration

Add the plugin to your medusa-config.ts:

module.exports = defineConfig({
  // ... other config
  modules: [
    {
      resolve: "@medusajs/medusa/notification",
      options: {
        providers: [
          // Default provider
          {
            resolve: "@medusajs/medusa/notification-local",
            id: "local",
            options: {
              name: "Local Notification Provider",
              channels: ["feed"],
            },
          },
          // Nodemailer provider
          {
            resolve: "@perseidesjs/notification-nodemailer/providers/nodemailer",
            id: "nodemailer",
            options: {
              from: process.env.NOTIFICATION_PROVIDER_FROM,
              channels: ["email"],
              host: process.env.SMTP_HOST,
              port: process.env.SMTP_PORT,
              secure: false,
              auth: {
                user: process.env.SMTP_USER,
                pass: process.env.SMTP_PASS
              }
            },
          },
        ],
      },
    },
  ]
})

Environment Variables

Create a .env file with your SMTP configuration:

NOTIFICATION_PROVIDER_FROM=[email protected]
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your-app-password

Required Options

  • from: Default sender email address
  • host: SMTP server hostname
  • port: SMTP server port (e.g., 587 for TLS, 465 for SSL)

Optional Options

  • secure: Use TLS/SSL (default: false)
  • auth: Authentication credentials (user and pass)
  • Any other Nodemailer SMTP options