New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@point-hub/nodemailer-inlinecss

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@point-hub/nodemailer-inlinecss

A Nodemailer plugin for inlining CSS

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-46.15%
Maintainers
1
Weekly downloads
 
Created
Source

Nodemailer Inlining CSS

@point-hub/nodemailer-inlinecss is an ESM-only module - you are not able to import it with require().

Install

Install from npm

npm install @point-hub/nodemailer-inlinecss

Usage

Internal Styles

import { createTransport } from "nodemailer";
import { PluginFunction } from "nodemailer/lib/mailer";
import inlineCss from "@point-hub/nodemailer-inlinecss";

var transporter = nodemailer.createTransport();
transporter.use('compile', inlineCss() as PluginFunction);
transporter.sendMail({
    from: '...',
    to: '...',
    html: '<style>div { color:black; }</style><div>Hello world</div>'
});

Will result in an email with the following HTML:

<div style="color: black;">Hello world</div>

External Styles

import fs from "fs";
import { createTransport } from "nodemailer";
import { PluginFunction } from "nodemailer/lib/mailer";
import inlineCss from "@point-hub/nodemailer-inlinecss";

var transporter = nodemailer.createTransport();
transporter.use('compile', inlineCss({
    extraCss: fs.readFileSync("./src/styles.min.css").toString(),
}) as PluginFunction);
transporter.sendMail({
    from: '...',
    to: '...',
    html: '<div>Hello world</div>'
});

Your external css file.

div {
  color: black;
}

Will result in an email with the following HTML:

<div style="color: black;">Hello world</div>

Keywords

FAQs

Package last updated on 05 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc