Create email templates for Medusa
π§ Powerful, Flexible Email Templating for MedusaJS
Install the package using npm:
npm install @vymalo/medusa-mailOr using yarn:
yarn add @vymalo/medusa-mail1interface EmailConfig<T = any> {2 // Nodemailer message configuration3 message?: Mail.Options;4
5 // Email transport options6 transport?: NodeMailerTransportOptions;7
8 // Template views and rendering9 views?: View;10
11 // Send behavior control12 send?: boolean;13 preview?: boolean | PreviewEmailOpts;14
15 // Advanced rendering options16 customRender?: boolean;17 render?: (view: string, locals?: T) => Promise<any>;18 19 // Internationalization20 i18n?: any;21
22 // Rendering configurations23 textOnly?: boolean;24 htmlToText?: HtmlToTextOptions | false;25 26 // Subject line customization27 subjectPrefix?: string | false;28
29 // HTML inlining and styling30 juice?: boolean;31 juiceSettings?: JuiceGlobalConfig;32 juiceResources?: juice.Options;33
34 // Custom template path resolution35 getPath?: (path: string, template: string, locals: any) => string;36}1modules: [2 {3 resolve: "@medusajs/medusa/notification",4 options: {5 providers: [6 {7 resolve: `@vymalo/medusa-mail`,8 id: "email-provider",9 options: {10 // Basic configuration11 channels: ["email"],12 message: {13 from: "no-reply@yourcompany.com"14 },15 16 // Environment-specific settings17 send: process.env.NODE_ENV === "production",18 preview: process.env.NODE_ENV !== "production",19 20 // Transport configuration21 transport: "smtp://localhost:1025",22 23 // Advanced customizations24 subjectPrefix: process.env.NODE_ENV !== "production" 25 ? `[${process.env.NODE_ENV.toUpperCase()}]` 26 : false,27 28 // HTML to text conversion29 htmlToText: {30 wordwrap: 130,31 preserveNewlines: true32 }33 },34 },35 ],36 },37 }38]Contributions welcome!