mailbuilder

2.1.2 • Public • Published

mailbuilder

Simplified email message composition library for Node.js

npm codecov node Typed with TypeScript

This is simple library (no dependencies) to generate HTML-only email messages (without attachments) from given parameters. Supports Unicode for names and subject, but encodes only when it's actually required:

const { simpleHtmlEmail } = require('mailbuilder');
 
const testMsg = {
  from: { name: 'John "Cool" Doe', address: 'john@doe.com' },
  to: [{ name: 'Вася Пупкин', address: 'vasya@pupkin.com' }],
  bcc: [
    { name: 'One Spy', address: 'spy@kremlin.ru' },
    { name: 'Big Eye', address: 'fbi@whitehouse.org' },
  ],
  subject: 'Some 💄 subject',
  html: `This is our <b>html</b> message content
      It's also <i>multiline</i> just in case`,
};
const res = simpleHtmlEmail(testMsg);
 
/**
 
res:
From: \\"John \\\\\\"Cool\\\\\\" Doe\\" <john@doe.com>
To: =?utf-8?B?0JLQsNGB0Y8g0J/Rg9C/0LrQuNC9IDx2YXN5YUBwdXBraW4uY29tPg==?=
Content-Type: text/html; charset=utf-8
MIME-Version: 1.0
Bcc: One Spy <spy@kremlin.ru>, Big Eye <fbi@whitehouse.org>
Subject: =?utf-8?B?U29tZSDwn5KEIHN1YmplY3Q=?=
 
This is our <b>html</b> message content
      It's also <i>multiline</i> just in case"
 
**/

License

MIT licensed by Konstantin Vyatkin tino@vtkn.io

Readme

Keywords

Package Sidebar

Install

npm i mailbuilder

Weekly Downloads

2

Version

2.1.2

License

MIT

Unpacked Size

25.5 kB

Total Files

27

Last publish

Collaborators

  • tinovyatkin