All Projects → forwardemail → Preview Email

forwardemail / Preview Email

Licence: mit
Automatically opens your browser to preview Node.js email messages sent with Nodemailer. Made for Lad!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Preview Email

Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+2838.39%)
Mutual labels:  email, nodemailer, templates, pug
laravel-mjml
Laravel MJML offers support for rendering MJML syntax into in-line HTML that can be sent within mails.
Stars: ✭ 26 (-76.79%)
Mutual labels:  email, templates, render
dry
Dry is a new template engine and language, and is a superset of Shopify's Liquid, with first-class support for advanced inheritance features, and more. From the creators of Enquirer, Assemble, Remarkable, and Micromatch.
Stars: ✭ 66 (-41.07%)
Mutual labels:  engine, templates, render
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 294 (+162.5%)
Mutual labels:  engine, demo
activism-mailbot
No description or website provided.
Stars: ✭ 49 (-56.25%)
Mutual labels:  email, emails
amazon-workmail-lambda-templates
Serverless applications for Amazon WorkMail.
Stars: ✭ 17 (-84.82%)
Mutual labels:  email, templates
mjml-syntax
Sublime package for the MJML
Stars: ✭ 44 (-60.71%)
Mutual labels:  email, emails
Holehe
holehe allows you to check if the mail is used on different sites like twitter, instagram and will retrieve information on sites with the forgotten password function.
Stars: ✭ 568 (+407.14%)
Mutual labels:  email, emails
Miox
Modern infrastructure of complex SPA
Stars: ✭ 374 (+233.93%)
Mutual labels:  engine, demo
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 589 (+425.89%)
Mutual labels:  engine, demo
Test demo
Testing Using Python Demo. 使用Python测试脚本demo。
Stars: ✭ 60 (-46.43%)
Mutual labels:  demo, test
urlbox-screenshots-node
Capture website thumbnails using the urlbox.io screenshot as a service API in node
Stars: ✭ 14 (-87.5%)
Mutual labels:  render, preview
Bojler
Bojler is an email framework
Stars: ✭ 885 (+690.18%)
Mutual labels:  email, templates
Goscraper
Golang pkg to quickly return a preview of a webpage (title/description/images)
Stars: ✭ 72 (-35.71%)
Mutual labels:  engine, preview
muil
Muil is a framework to build, maintain and manage dynamic templates using React and tools you know and love
Stars: ✭ 26 (-76.79%)
Mutual labels:  email, templates
Node Express Mongoose Demo
A simple demo app using node and mongodb for beginners
Stars: ✭ 4,976 (+4342.86%)
Mutual labels:  demo, pug
Swiftmailer
Comprehensive mailing tools for PHP
Stars: ✭ 9,503 (+8384.82%)
Mutual labels:  email, emails
nestjs-mailer
🌈 A simple implementation example with and without email-templates using mailer module for nest js built on top of nodemailer.
Stars: ✭ 82 (-26.79%)
Mutual labels:  pug, nodemailer
nuxt-mail
Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Stars: ✭ 62 (-44.64%)
Mutual labels:  email, nodemailer
Nodejs Template Emails
Sending template emails in Node.JS
Stars: ✭ 12 (-89.29%)
Mutual labels:  email, nodemailer

preview-email

build status code coverage code style styled with prettier made with lass license

Automatically opens your browser to preview Node.js email messages sent with Nodemailer. Made for Lad!

Table of Contents

Screenshot

demo screenshot

Install

npm:

npm install preview-email

yarn:

yarn add preview-email

Usage

NOTE: You should probably just use email-templates directly instead of using this package.

The function previewEmail returns a Promise which resolves with a URL. We automatically open the browser to this URL unless you specify options.open as false (see Options for more info).

const previewEmail = require('preview-email');
const nodemailer = require('nodemailer');

const transport = nodemailer.createTransport({
  jsonTransport: true
});

// <https://nodemailer.com/message/>
const message = {
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Hello world',
  html: '<p>Hello world</p>',
  text: 'Hello world',
  attachments: [ { filename: 'hello-world.txt', content: 'Hello world' } ]
};

// note that `attachments` will not be parsed unless you use
// `previewEmail` with the results of `transport.sendMail`
// e.g. `previewEmail(JSON.parse(res.message));` where `res`
// is `const res = await transport.sendMail(message);`
previewEmail(message).then(console.log).catch(console.error);

transport.sendMail(message).then(console.log).catch(console.error);

Custom Preview Template and Stylesheets

Using the options.template object, you can define your own template for rendering (e.g. get inspiration from template.pug and write your own!):

const path = require('path');

// ...

previewEmail(message, { template: path.join(__dirname, 'my-custom-preview-template.pug') })
  .then(console.log)
  .catch(console.error);

Debugging

Thanks to the debug package, you can easily debug output from preview-email:

DEBUG=preview-email node app.js

Options

  • message (Object) - a Nodemailer message configuration object
  • options (Object) - an object with the following two properties:
    • id (String) - a unique ID for the file name created for the preview in dir (defaults to uuid.v4() from uuid)
    • dir (String) - a path to a directory for saving the generated email previews (defaults to os.tmpdir(), see os docs for more insight)
    • open (Object or Boolean) - an options object that is passed to open (defaults to { wait: false }) - if set to false then it will not open the email automatically in the browser using open, and if set to true then it will default to { wait: false }
    • template (String) - a file path to a pug template file (defaults to preview-email's template.pug by default) - this is where you can pass a custom template for rendering email previews, e.g. your own stylesheet
    • urlTransform (Function (path) => url) - a function to build preview url from file path (defaults to (path) => 'file://[file path]') - this is where you can customize the opened path to handle WSL to Windows transformation or build a http url if dir is served.

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].