Git Product home page Git Product logo

email-builder-js's Introduction

EmailBuilder.js

Demo / Playground ·  EmailBuilderJS.com ·  GitHub

Introduction

EmailBuilder.js is a free and open-source email template builder for developers. Build emails faster than ever with clean JSON or HTML output that render well across clients and devices.

Use our playground or learn more about how to get started using EmailBuilder.js.

Image of builder

Image of designer


Build simple welcome emails to complex reports

Use a no-code builder that is flexible enough to create a wide variety of template designs – from simple welcome emails to complex reports.

Image of example templates

Sample templates available in the playground:


Why?

It's finally time to stop using 90's style HTML and CSS to build product emails. EmailBuilder.js takes inspiration from editor.js and email component libraries and puts them into an easy to use no-code builder to that allow the entire team to build emails.

Since the builder is completely free and open source, teams can self-host the builder and extend as needed.


Built-in blocks

Each block is it's own npm package that can be included in the builder. These are the ones that are built-in:


Email client support

All blocks are tested and supported by modern email clients (on both desktop and mobile) including: Gmail, Apple Mail, Outlook, Yahoo! Mail, HEY and Superhuman.

Image of mobile rendering

Email builder output

The email builder can output to a clean JSON or raw HTML. You can see this from the playground by simply clicking on the HTML or JSON tabs in the builder.

Image of JSON in builder


Using EmailBuilder.js

Install the package in your project:

npm install --save @usewaypoint/email-builder

Given an EmailBuilder.js configuration (the JSON output of the builder):

import { TReaderDocument } from '@usewaypoint/email-builder';

const CONFIGURATION: TReaderDocument = {
  root: {
    type: 'EmailLayout',
    data: {
      backdropColor: '#F8F8F8',
      canvasColor: '#FFFFFF',
      textColor: '#242424',
      fontFamily: 'MODERN_SANS',
      childrenIds: ['block-1709578146127'],
    },
  },
  'block-1709578146127': {
    type: 'Text',
    data: {
      style: {
        fontWeight: 'normal',
        padding: {
          top: 16,
          bottom: 16,
          right: 24,
          left: 24,
        },
      },
      props: {
        text: 'Hello world',
      },
    },
  },
};

You can render the EmailBuilder.js configuration to an HTML email string:

import { renderToStaticMarkup } from '@usewaypoint/email-builder';

const string = renderToStaticMarkup(CONFIGURATION, { rootBlockId: 'root' });

Or you can render the EmailBuilder.js configuration by using the <Reader /> React component:

import { Reader } from '@usewaypoint/email-builder';

<Reader document={CONFIGURATION} rootBlockId="root" />;

Sending emails

In most cases, you'll want to take the EmailBuilder.js configuration, render it to HTML, and then send it as an email. Here are a couple of examples on how you can do this using the same configuration from the examples above.


Sending through nodemailer

import { renderToStaticMarkup } from '@usewaypoint/email-builder';
import nodemailer from "nodemailer";

// Replace this with your transport configuration
const transportConfig = {}
const transporter = nodemailer.createTransport(transportConfig);

// Replace this with the JSON for your Reader document
const CONFIGURATION: TReaderDocument = {}

await transporter.sendMail({
  from: '[email protected]'
  to: '[email protected]',
  subject: 'Hello',
  html: renderToStaticMarkup(CONFIGURATION, { rootBlockId: 'root' }),
});

Sending through an email API

We'll use Waypoint for this example, however, you can use any email API like Amazon SES, SendGrid, or MailGun.

import axios from 'axios';

import { renderToStaticMarkup } from '@usewaypoint/email-builder';

// Replace this with the JSON for your Reader document
const CONFIGURATION: TReaderDocument = {}

await axios({
  method: 'post',
  url: 'https://live.waypointapi.com/v1/email_messages',
  headers: {
    'Content-Type': 'application/json',
  },
  auth: {
    username: API_KEY_USERNAME,
    password: API_KEY_PASSWORD,
  },

  data: {
    from: '[email protected]'
    to: '[email protected]',
    subject: 'Hello',
    bodyHtml: renderToStaticMarkup(CONFIGURATION, { rootBlockId: 'root' }),
  },
});

Self hosting the Editor

Fork this repository and use packages/editor-sample as an example for self-hosting.

Quick start:

  1. Fork this repository.
  2. Open up directory in terminal.
  3. Go to the editor-sample package: cd packages/editor-sample
  4. Install packages: npm install
  5. Run the server: npx vite
  6. Open in browser: http://localhost:5173/email-builder-js/

Contribute

Feel free to report any bug on the issues page. If possible, please add steps, information, screenshots, or videos to help us reproduce them.

If you are looking to provide code contribututions to EmailBuilder.js, please fork the repository and create a new pull request. We will check your code closely and provide feedback.




Brought to you by Waypoint

EmailBuilder.js is the community version of our much-loved no-code template builder on Waypoint. If you are looking for a better collaboration experience for your team, check out Waypoint's email API with a hosted template builder with dynamic LiquidJS variables, drag and drop, Markdown formatting, reusable layouts, loops, and additional blocks.


Looking for something special?

Need special consultation, a one-off feature, integration, or something else for your business? We can help or put you in touch with someone that can – contact us at [email protected] and share your details.

email-builder-js's People

Contributors

cohitre avatar jordanisip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

email-builder-js's Issues

Feature Request: Support Embedding Local Image Files in HTML Files

The current system does not support embedding local image files in HTML files. This causes inconvenience for users as they have to first upload images to online storage and then use the image links in HTML.

We need to add a feature that allows users to read image files directly from the local file system and embed them into HTML files. This will improve the user experience and streamline the workflow.

As described in this Stack Overflow question: https://stackoverflow.com/questions/74885017/node-js-reading-local-image-file-and-use-them-in-html-files

<img src="data:image/png;base64,${img}" />

Example from readme not working

Hi there,

I've been trying to integrate the renderHtmlDocument method from your repository into my project but haven't had any luck. It appears that this method isn’t actually available in the repository. I might be overlooking something, but I couldn’t find it in the codebase.

Additionally, I attempted to implement it on the server but faced similar issues. Could you please confirm if this method is part of an upcoming release? Access to it would indeed be very beneficial for my needs.

Thank you for your assistance!

import { renderHtmlDocument } from '@usewaypoint/email-builder';
import nodemailer from "nodemailer";

// Replace this with your transport configuration
const transportConfig = {}
const transporter = nodemailer.createTransport(transportConfig);

// Replace this with the JSON for your Reader document
const CONFIGURATION: TReaderDocument = {}

await transporter.sendMail({
  from: '[email protected]'
  to: '[email protected]',
  subject: 'Hello',
  html: renderHtmlDocument(CONFIGURATION, 'root'),
});

Few requests: sidebar blocks and drag&drop,

Hello team,

Amazing work you have done so far and thank you for making this open source.

Few request: when do you think we can have these features?

  1. Sidebar blocks instead of inline (unlayer example)
  2. Drag and Drop for blocks
  3. Re-positioning of elements within the content

Great work @jordanisip @cohitre

Feature Request: Data Persistence and Auto-Save to Prevent Data Loss

Description

Currently, if users accidentally close the browser tab or experience a browser crash while using the email builder, they lose all their progress and work. This can be extremely frustrating, especially if they have spent a significant amount of time creating or modifying an email template.

To prevent this frustrating scenario and ensure users don't lose their hard work, I think that it would be beneficial to implement a feature that automatically saves their progress at regular intervals or whenever changes are made. This way, when they reopen the email builder, they can pick up right where they left off.

Is this something that already is or could be added to the roadmap or development timeline for the email builder in the near future? If not, what would be the best way to contribute or propose this feature?

Allow transparant color or an easy way to use the backdrop color in components to be set as the background color

Whenever you like to design an email template with a 'floating logo', the the container should not have a background color, or the background color must be the same as the backdrop color. Not sure if allowing transparant color (or no background color) on (container) elements have compatiblity issues in email clients, but I assume that that should work fine. If that's not the case, then it would be really convenient to use the configured backdrop color easily as the background color of a container component. Right now, you need to switch from the component edit mode, to the global styles view, copy the backdrop color, switch back again, and paste it there.

Would be a nice enhancements of the email builder.

Allow to export and import the JSON

In the builder it would be cool if you can export the JSON, or import it. So that I can store an email design locally, and when I like to tweak it import (or copy paste) the JSON again, so that I can continu designing the email template.

Your brand name on the email builder

Hey there,

I'm curious if your brand name is displayed on the email editor upon integration and usage. Additionally, could you confirm if it's compatible with Angular 17?

Thanks

Kiko

-LOOKING FOR MORE?
Waypoint is an email API service with a hosted 'pro' template builder with Markdown, dynamic variables, loops, conditionals, drag and drop, layouts, and more.

Border radius not correctly applied

Hey,

Loving what you guys are doing with this email builder. I noticed a small bug. When applying a border radius to a container, the border radius is not correctly applied. Nothing happens with the borders, unless you specify a border color. In that case, only the border itself will be rounded, instead of the container itself. Notice the white background color in the corners:

Scherm­afbeelding 2024-04-12 om 10 28 06

Used the following settings:

Scherm­afbeelding 2024-04-12 om 10 28 10

When I apply a border radius, I expect this to work, also when no specific border color is specified. Next to that you can only define the border radius for the full container, you can choose to have a different radius for the left top corner and the right top corner only. Having this ability will allow users to create also beautiful rounded templates. Now the builder only supports rectangular designs.

Compile lib as CommonJS

Including email-builder-js is strictly limited as it is not CommonJS compiled.

Here is CommonJS compiled version: lib

Here is TS working example, lib added to srouce: sample

New lines aren't being applied

When using a text block it would be helpful if it supports new lines. Whenever I add a new line in the text, it's not applied in the design. Not sure if this is a conscious decision? Because of the not supporting of new lines, most blocks have to be converted to a HTML block, which feels overkill.

Scherm­afbeelding 2024-04-14 om 09 58 05 Scherm­afbeelding 2024-04-14 om 09 58 09

More global fonts, RTL support

Hello there, I really like the way you guys are doing this and thank you for sharing it to the public.

However, as an Arabic developer, I find it a hustle to download the desired font (Arabic supported fonts) or to modify the template manually each time I export to HTML. What I would love to is to have the following:

1- Add more global fonts, try google fonts maybe?
2- RTL Support, its an HTML attribute.
3- Add the ability to use variables using the format {{variableName}}.

Again I appreciate the work and efforts.
Thanks guys.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.