Skip to content

andris9/nodemailer-html-to-text

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Nodemailer plugin to generate text content from HTML

This applies to Nodemailer v1.1+. The plugin checks if there is no text option specified and populates it based on the html value.

This plugin is meant as replacement for the generateTextFromHTML option that was removed from Nodemailer 1.0

Install

Install from npm

npm install nodemailer-html-to-text --save

Usage

Load the htmlToText function

var htmlToText = require('nodemailer-html-to-text').htmlToText;

Attach it as a 'compile' handler for a nodemailer transport object

nodemailerTransport.use('compile', htmlToText(options))

Where

Example

var nodemailer = require('nodemailer');
var htmlToText = require('nodemailer-html-to-text').htmlToText;
var transporter = nodemailer.createTransport();
transporter.use('compile', htmlToText());
transporter.sendMail({
    from: 'me@example.com',
    to: 'receiver@example.com',
    html: '<b>Hello world!</b>'
});

License

MIT

About

Nodemailer plugin to generate text content from HTML

Resources

License

Stars

Watchers

Forks

Packages

No packages published