Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 2.15 KB

File metadata and controls

59 lines (43 loc) · 2.15 KB

@constructive-io/mjml

MJML email HTML templates for Constructive

Generates responsive email HTML from a single generate() call with configurable header, message + CTA button, and footer. Peer dependencies: react (>=16), react-dom (>=16).

Installation

npm install @constructive-io/mjml

Usage

import { generate } from '@constructive-io/mjml';

const html = generate({
  title: 'Confirm your email',
  message: 'Click the button below to confirm.',
  link: 'https://example.com/confirm?token=abc',
  linkText: 'Confirm',
  companyName: 'Acme, Inc.',
  supportEmail: 'support@acme.com',
  website: 'https://acme.com',
  logo: 'https://acme.com/logo.png'
});

// Send html with @constructive-io/postmaster or any email sender

API

generate(options?: GenerateOptions): string

Returns email HTML. All options are optional; defaults provide a generic template.

Options: title, link, linkText, message, subMessage, bodyBgColor, messageBgColor, messageTextColor, messageButtonBgColor, messageButtonTextColor, companyName, supportEmail, website, logo, headerBgColor, headerImageProps.

Components

  • Header, Footer, ButtonWithMessage — exported for custom compositions with mjml-react.
  • Types: GenerateOptions, HeaderProps, FooterProps, ButtonWithMessageProps, HeaderImageProps.