# nodemailer-html-to-text

> Generate text content from html for Nodemailer e-mails

Latest version **3.2.0** (published 2021-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodemailer-html-to-text
pnpm add nodemailer-html-to-text
yarn add nodemailer-html-to-text
bun add nodemailer-html-to-text
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2021-04-22 |
| First published | 2014-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/nodemailer-html-to-text) |
| Module format | CommonJS |
| Node | >= 10.23.0 |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51 |
| Author | Andris Reinman |
| Maintainers | andris |
| Keywords | Nodemailer |

## Links

- npm: https://www.npmjs.com/package/nodemailer-html-to-text
- Repository: https://github.com/andris9/nodemailer-html-to-text
- Issues: https://github.com/andris9/nodemailer-html-to-text/issues
- npm.io page: https://npm.io/package/nodemailer-html-to-text

## Dependencies (1)

- [html-to-text](https://npm.io/package/html-to-text.md) 7.1.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2021-04-22
- 3.1.0 — 2019-09-02
- 3.0.0 — 2018-06-26
- 2.1.0 — 2016-04-11
- 1.0.2 — 2015-07-20
- 1.0.1 — 2015-03-20
- 1.0.0 — 2014-07-30

## README

# 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

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

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

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

Where

  * **options** - includes options for the [html-to-text](https://www.npmjs.org/package/html-to-text) converter

## Example

```javascript
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**

---
_Source: https://npm.io/package/nodemailer-html-to-text · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
